[prev in list] [next in list] [prev in thread] [next in thread]
List: sas-l
Subject: Re: How can I print only a few rows out of a big data table?
From: Andrew Smith <ajs2004 () BIGFOOT ! COM>
Date: 2007-02-28 16:19:03
Message-ID: 200702281619.l1SGDDrO016173 () mailgw ! cc ! uga ! edu
[Download RAW message or body]
>Note that's just an untested, unpolished starter..
Worked for me.
He can also get a similar report with PROC PRINT -
proc print;
id obs;
by obs;
format a b c d $na.;
run;
Example 8: Creating a Customized Layout with BY Groups and ID Variables
http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/a002262178.htm
http://support.sas.com/onlinedoc/913/getDoc/en/proc.hlp/ods/a000612624.htm
On Wed, 28 Feb 2007 07:52:11 -0500, Arild S <sko@KLP.NO> wrote:
>On Wed, 28 Feb 2007 09:56:59 +0100, yuan he <yuen.he@GMAIL.COM> wrote:
>
>>Thanks very much you guys, may I ask some thing more,
>>i have a dataset looks like
>>
>> obs1 a1 b1 c1 d1
>>obs1 a2 b2 na d2
>>obs1 a3 na na d3
>>obs1 na na na d4
>> obs2 a4 b3 c2 d5
>>obs2 a5 b4 na d6
>>obs2 a6 na na d7
>>obs2 na na na d8
>>
>>if I would like to have my dataset in this form like below (because this
>>table look is easier for people to read),
>>-----------------------------------------------------
>>obs1 a1 b1 c1 d1
>> a2 b2 d2
>> a3 d3
>> d4
>>------------------------------------------------------
>>obs2 a4 b3 c2 d5
>> a5 b4 d6
>> a6 d7
>> d8
>>-----------------------------------------------------
>>..........
>>
>>How can i do with this? which proc should I use? or maybe ODS can help me
>>get that?
>>
>>and the last step is to print the table look dataset out one obs by one
>obs,
>>which i decided to use sas macro.
>>I appreciate the help from the previous email, and i m reading the sas
>macro
>>now.
>>
>>another question is if i only want to operate with the 5th row. is it the
>>only way that like: data=aa(firstobs=5,obs=5)
>>what if I want to opertate with the 5th column? like in R we say aa[5,] or
>>aa[,5] to refer the 5th row and 5th column.
>>
>>Thank you very much for the help, and it really triggered my interests to
>>learn SAS.
>>Best regards,
>>Yuan.
>>
>>
>>
>
>Hi, so you have
>
>data in;
> input (obs a b c d)($);
>datalines;
>obs1 a1 b1 c1 d1
>obs1 a2 b2 na d2
>obs1 a3 na na d3
>obs1 na na na d4
>obs2 a4 b3 c2 d5
>obs2 a5 b4 na d6
>obs2 a6 na na d7
>obs2 na na na d8
>;
>run;
>
>then make a format to display "na" as blanks:
>
>proc format;
> value $na
> 'na' =' '
> ;
>run;
>
>then you can look up proc report and investigate.. it
>has a lot of features. Supports ODS now as well, I think..
>
>proc report data=in nowd;
> columns obs a b c d;
> define obs / group;
> format a b c d $na.;
>run;
>
>Note that's just an untested, unpolished starter.. look it up.
>
>If you're new you can also have fun with customizing your
>own report, to make that old-school, plain listing you have above..
>
>data _null_;
> set in;
> by obs;
> file print;
> format a b c d $na.;
> if first.obs then do;
> put / 50*'.';
> put @2 obs @10 a @20 b @30 c @40 d;
> end;
> else put @10 a @20 b @30 c @40 d;
>run;
>
>'/' skips a line, 50*'.' is self-explanatory, @10 puts the pointer at the
>position 10 in the line.. 'first.obs' is 1 on the first obs when you 'set;
>by ..;' else 0. Ok, look that up as well.
>
>In your case "one obs at a time" means several (4 +/-) rows of data, right?
>Why not skip obs/firstobs and just include a where statement??
> Where obs = 'obs1'; *or whatever..
>Forget the macro, it'll do you no good (here/ yet) ;-)
>
>Good luck!
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic