Date: Mon, 17 Mar 2008 16:22:38 -0500
Reply-To: "data _null_," <datanull@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "data _null_," <datanull@GMAIL.COM>
Subject: Re: how to use proc contents to get how many numerical and
character for the formated dataset?
In-Reply-To: <c1082549-6075-48f8-8634-e33d4413e611@59g2000hsb.googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
I do not understand what you want. The format does not change the
variables type. Just the way the values are displayed. The data are
unchanged.
Can you see how I am confused by your question?
On Mon, Mar 17, 2008 at 4:02 PM, Irene <irenelj23@gmail.com> wrote:
> data carsurvey;
> input age sex income color $;
> cards;
> 19 1 14000 Y
> 45 1 65000 B
> 72 2 35000 B
> 31 1 44000 Y
> ;
> proc format;
> value gender 1='male'
> 2='female';
> value agegroup 13-<20='teen'
> 20-<65='adult'
> 65-High='Senior";
> value $col 'W '='Moon White'
> 'B'='sky blue'
> 'Y'='yellow';
>
> proc print data=carsurvey;
> format sex gender. age agegroup. color $col. Income Dollar8.;
> run;
>
>
> After run this program we can get the output listed below(I did not
> copy all the outputs just some useful one for my question):
> Obs age sex income color
>
> 1 teen male 14000 yellow
> 2 adult male 65000 sky
> blue
> 3 Senior female 35000 sky
> blue
> 4 adult male 44000 yellow
>
>
> -----Alphabetic List of Variables and
> Attributes-----
>
> # Variable Type Len Pos
>
> 1 age Num 8 0
> 4 color Char 8 24
> 3 incomme Num 8 16
> 2 sex Num 8 8
>
>
>
>
>
> Now, my question is that for each of the original datalines, there
> are 3 numerical and one character. However, after the format, the
> output listed above has only one numeric variable (Incomme), the rest
> are all character variables. How can I use proc contents to get the
> correct numeric or character for the output data?
> I need a general way to do so, for example if there are 300 variables
> in the output, I can also get the type of variables for the output
> data.
>
> Hope I stated my problem clearly.
>
|