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 (July 2002, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 12 Jul 2002 09:52:29 -0400
Reply-To:     Ed Heaton <EdHeaton@WESTAT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ed Heaton <EdHeaton@WESTAT.COM>
Subject:      Re: query: creating macro variables
Comments: To: Don Aya <donsas99@HOTMAIL.COM>
Content-Type: text/plain


The following should do the trick. It creates a series of macro LET statements and then uses those statements to assign your macro variables.

Data x ; Input subject Y $ ; Cards ; 1 A 2 AB 3 ABC ; Proc sql /*noPrint*/ ; Select '%let subject' || /* Must use single-quotes here. */ trim( left( put(subject,5.) ) ) || "=" || trim(Y) || ";" into :lets from x ; Quit ; &lets


Edward Heaton, Senior Systems Analyst, Westat (An Employee-Owned Research Corporation), 1550 Research Boulevard, Room 2018, Rockville, MD 20850-3195 Voice: (301) 610-4818 Fax: (301) 294-3992

-----Original Message----- From: Don Aya [mailto:donsas99@HOTMAIL.COM] Sent: Thursday, July 11, 2002 5:47 PM To: SAS-L@LISTSERV.UGA.EDU Subject: query: creating macro variables

Hello SAS-Lers;

I have a macro question which I hope you can help. Suppose I have the following data set:

data x; input subject Y $; cards; 1 A 2 AB 3 ABC ; run

I want to creat macro variables for each subject such that &subject1 has 'A' &subject2 has 'AB' &subject3 has 'ABC'

I highly appreciate your help.



_________________________________________________________________ Chat with friends online, try MSN Messenger:

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