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 2012, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 12 Mar 2012 09:55:35 -0500
Reply-To:     "Data _null_;" <iebupdte@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Data _null_;" <iebupdte@GMAIL.COM>
Subject:      Re: Removing STRINGS from A MACRO VARIABLE VALUE XXXX
Comments: To: Dan Abner <>
In-Reply-To:  <>
Content-Type: text/plain; charset=ISO-8859-1

If we're talking about variable names here is how I do it. The advantages to fiddling with scan/transtrn and loops are obvious.

data have; length DATE1 MTH YEAR ACTIVE date_open Data_closed MTH2 MTH3 $1; stop; call missing(of _all_); run;


proc transpose data=have(obs=0) out=list1; var &vars; run; proc transpose data=have(obs=0) out=list2; var &m; run; proc sql noprint; select _name_ into :VarsNo_M separated by ' ' from list1 where _name_ ne ALL(select _name_ from list2) ; quit; run; %put NOTE: VarsNo_M=&varsno_m;

On 3/12/12, Dan Abner <> wrote: > Hi everyone, > > I have the following code. I want to remove all variables listed in > the &M macro variable (REGARDLESS OF ORDER) from the &VARS variable > and save the results as &E. What I have works well except it requires > that the variables be in the same order in &VARS and &M (which is > definitely NOT the case). What is the easiest way to do this? > > %LET VARS = DATE1 MTH YEAR ACTIVE DATE_OPEN DATA_CLOSED MTH2 MTH 3; > %LET M = DATE_OPEN MTH2; > > %LET E = %SYSFUNC(TRANWRD(&VARS,%STR(&M),%STR())); > > > Thanks! > > Dan >

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