Date: Sat, 4 Nov 2006 16:28:17 -0500
Reply-To: SAS_learner <proccontents@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: SAS_learner <proccontents@GMAIL.COM>
Subject: Re: OT: Chance to Make SAS-L History: Did You Know That...
In-Reply-To: <c2192a610611031613j73e8d1a1qb85d787099557a19@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
What going on did we reach the 150 or 300 posts (as david said ) or we are
out tips, Just curious if there any tips uisng SQL or Little Utlity macros
or some Domain knowledge, What I have in mind is people working various
different fields Like people working in Pharma Industry use SAS for mostly
do Tables and listings and DM work. They can share their valuable experience
(tricks or tips ) unique to their field, I do not know how SAS is used in
Financial sector ( do we have a similar kind of Knowledge ) or in energy
sector or Eductional sector or Pharama Marketing ?? Or Usefull Url's for
various subjects.
Here is another trick I use often at my work place
Use PROC SQL dictionary tables to create a macro variable containing the
variable names from a specified data set.
Use PROC DATASETS to execute the rename.
data
a;
col1=1; col2=2; col3=3; col5=5;
x=123;
run;
proc sql noprint;
select trim(name)||'=NEW'||substr(name,4)
into :varlist separated by ' '
from DICTIONARY.COLUMNS
WHERE LIBNAME EQ "WORK" and MEMNAME EQ "A"
and upcase(name) like 'COL%';
quit;
proc datasets library=work nolist;
modify a;
rename &varlist;
quit;
On 11/3/06, SAS_learner <proccontents@gmail.com> wrote:
>
> Small Tip/Trick I learned from my manager who is also SAS-L Member. This
> is close to call symput but runs on data rather than on metadata
>
>
> Do something samething in all datasets in a lib you can do something like
> this,Here I am droppping one variable from all the datasetsn
>
> %macro octa(ds= );
> data datout.&ds;
> set datout.&ds ;
> drop OCTA_SEQ;
> run;
> %mend;
>
> proc sql noprint;
> select '%octa('||'ds= '||lowcase(memname)||')' into :blanks separated by
> ';'
> from dictionary.tables
> where lowcase(libname) = 'datout';
> &blanks;
> quit;
>