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 (June 2002, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Mon, 24 Jun 2002 16:43:51 -0400
Reply-To:   "Shoemaker, Jack" <shoe@THOTWAVE.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Shoemaker, Jack" <shoe@THOTWAVE.COM>
Subject:   Re: Using a var value in a subsequent data step
Comments:   To: JSD <jsdavid1@HOTMAIL.COM>
Content-Type:   multipart/alternative;

JSD,

You really want that length stashed in a macro variable. Try this.

proc sql;

reset noprint;

select max( overall_length ) into :MAXLEN from formatting ; quit;

data mydata; set in; length my_var $&MAXLEN.; my_var = my_other_var; run;

HTH - Jack

-----Original Message----- From: JSD To: SAS-L@LISTSERV.UGA.EDU Sent: 6/24/02 4:05 PM Subject: Using a var value in a subsequent data step

Greetings,

I am stuck on particular block of code. Here is a snippet of some code that I am currently working with.

/********************************************************** proc means data=formatting; var overall_length; output out=formatting2 max(overall_length) = max_length; run; quit;

data mydata; length myvar $max_length.; /* <- stuck here */ set formatting2; myvar = my_other_var; run; quit;

************************************************************/

I get hung up in the data step. In the above proc the "max_length" var in the formatting2 data set will be of variable length. I would like to adjust the length of "myvar" to the value of the "max_length" var.

For example, if the value of the "max_length" var was 27, the length arument in the subsequent data step would be $27.

Any help or suggestions would be appreciated.

Thanks,

JSD


[text/html]


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