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 (April 2001, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 5 Apr 2001 09:36:33 -0400
Reply-To:     kviel <kviel@GMCF.ORG>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         kviel <kviel@GMCF.ORG>
Subject:      Re: Q on Macro Variable
Content-Type: text/plain; charset="iso-8859-1"

Perhaps by "merge" Rahul meant concatenate:

newvar=put(_n_, z10.) || &vartmp;

Rahul, please provide further explanation.

Kevin

-----Original Message----- From: Fehd, Ronald J. [mailto:rjf2@CDC.GOV] Sent: Thursday, April 05, 2001 9:32 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Re: Q on Macro Variable

> From: RAHUL CHAHAL [mailto:rahulchahal@YAHOO.COM] > I am trying to do the following: > > data tmp1; > set tempx(keep=var1); > if _n_=1; > run; > > %let vartmp=tmp1; /*<-Putting the only value for the > only variable into the macro variable*/ > > data tmp2; > set tempy; > newvar=_n_+&vartmp; > run; > > Obviously "VARTMP" is not created. What is correct way > to do beside using the merge to do it?

please explain what you are trying to do. again.

your code creates a data set TMP1 you assign the data set name TMP1 to a macro variable VARTMP data TMP2 reads data set TEMPY and attempts to create a new variable NewVar with the value of the observation counter, _N_ plus a data set name? VARTMP

now, if VARTMP were the name of a variable, instead of a data set name perhaps you want VARTMP to be Var1?

in that case: > data tmp2; if _N_ = 1 then set TMP1; > set tempy; newvar=_n_+Var1; > run;

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov OpSys: WinNT Ver: 8.1 ---> cheerful provider of UNTESTED SAS code!*! <--- e-mail your SAS improvements to: suggest@sas.com archives: http://www.listserv.uga.edu/archives/sas-l.html By using your intelligence you can sometimes make your problems twice as complicated. -- Ashleigh Brilliant ------------------------ CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or previous e-mail messages attached to it may contain proprietary, privileged or confidential information. If you are not an intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of any of the information contained in or attached to this transmission is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify me by reply e-mail and destroy the original transmission and its attachments without saving them in any manner. -----------------------


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