Date: Fri, 21 Jul 2006 12:25:26 -0700
Reply-To: qqzj <mrweisu@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: qqzj <mrweisu@GMAIL.COM>
Organization: http://groups.google.com
Subject: Re: How to assign values in macro variables to observations in a
dataset.
In-Reply-To: <1153506886.943238.136030@p79g2000cwp.googlegroups.com>
Content-Type: text/plain; charset="iso-8859-1"
Thanks Buffum:
I double checked your code. It works very well except that the value of
macro40 was given to observation number 4. I guess that SAS do not
arrange macro values into a orderly array.
Thanks a lot.
Dwight M. Buffum, MindTools, Inc. wrote:
> qqzj,
>
> I recommend using the SAS DICTIONARY.MACRO metadata table for a simple,
> one step solution. The DATA step below generates test data.
>
> DATA _NULL_;
> DO i=1 TO 100;
> CALL SYMPUTX(CATS('MAC',PUT(i,8.)),RANUNI(23));
> END;
>
> STOP;
> RUN;
>
>
> %PUT _USER_;
>
>
> PROC SQL;
> CREATE TABLE WORK.mydata AS
> SELECT INPUT(VALUE,32.) AS target
> FROM DICTIONARY.MACROS
> WHERE SUBSTR(NAME,1,3)='MAC'
> AND INPUT(SUBSTR(NAME,4),8.) BETWEEN 1 AND 100
> ;
> QUIT;
|