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?
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
Can you see how I am confused by your question?
On Mon, Mar 17, 2008 at 4:02 PM, Irene <firstname.lastname@example.org> wrote:
> data carsurvey;
> input age sex income color $;
> 19 1 14000 Y
> 45 1 65000 B
> 72 2 35000 B
> 31 1 44000 Y
> proc format;
> value gender 1='male'
> value agegroup 13-<20='teen'
> value $col 'W '='Moon White'
> 'B'='sky blue'
> proc print data=carsurvey;
> format sex gender. age agegroup. color $col. Income Dollar8.;
> 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
> 3 Senior female 35000 sky
> 4 adult male 44000 yellow
> -----Alphabetic List of Variables and
> # 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
> Hope I stated my problem clearly.