LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2005, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 15 Mar 2005 12:22:12 -0500
Reply-To:     "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:      Re: Fwd: Separating character variables for transpose

Try this:

proc transpose data=sashelp.class out=n prefix=n; by name; run;

proc transpose data=sashelp.class out=c prefix=c; by name; var _character_; run;

data _all_; set n c(where = (_name_ ne 'Name') ); run;

On Tue, 15 Mar 2005 16:23:59 -0000, SUBSCRIBE SAS-L Anonymous <sas@BOOSECAT.COM> wrote:

Sorry if this is a repost...I sent to an address entry "SASL" however it doesn't look like it sent it to the full SAS-L@LISTSERV.UGA.EDU address......................

Hi all, I'm kind of continuing from something I posted yesterday. In short, I'm wanting to transpose the data in a dataset. However I have both character and numeric fields that I need to transpose so I need to separate these out without hardcoding the variables.

I've determined what variables are char/num several different ways but urrently I'm doing: proc contents noprint data = ds1 out = varlist (keep = name type); run;

data char num; set varlist; if type = 1 then output num; if type = 2 then output char; run;

So I now know what variables are character and which are numeric. How can I merge this back into my original "DS1" dataset so I know what to break out? I've tried several different things including trying to create a macro variable to hold the name of the char variables (IE, charlist = charlist || ' ' || name).

If anyone has a minute and is able to solve this, I will be very grateful! I have similar problems to this come up often. As always, thanks for you time and help!

Andy


Back to: Top of message | Previous page | Main SAS-L page