From: Scott Barry on 20 Feb 2010 14:12 On Sat, 20 Feb 2010 13:00:30 -0500, Arthur Tabachneck <art297(a)NETSCAPE.NET> wrote: >While investigating one of this morning's posts, I was playing around with >proc sql's feedback option. The original question was whether one could >use a variable list in sql. > >Thus given data like: > >data have; > input qtr Col1 Col2 Col15676 Col15677 Col15678 Col15679 > Col15680 Col15681 Col15683 ColX; > cards; >1 1 2 3 4 5 6 7 8 9 0 >2 9 8 7 6 5 4 3 2 1 0 >; > >one could easily write something like the following to keep everything but >ColX: > >%let qtr=1; >proc sql feedback; > select * > from have (keep=Col1 Col2 Col15676-Col15681 Col15683) > where qtr=&qtr. >; >quit; > >SAS will put the full variable list into the log. Other than capturing >and parsing the log, is there a direct way to access the variable names >that SAS is obviously storing somewhere? The goal, in this case, would be >to include those names in an into: statement. > >Art Suggest checking your %PUT _AUTOMATIC_; variable list for a reference, specifically &SYSERRORTEXT. Scott Barry SBBWorks, Inc.
From: Sigurd Hermansen on 20 Feb 2010 15:04 Art: Perhaps not as direct as a keystroke macro, but not that difficult to adapt to whatever purpose you have for a variable name list: proc sql; select name into :varnames separated by ',' from dictionary.columns where libname="SASHELP" and memname="CLASS" and index(name,'eight') ; select Name,&varnames from SASHELP.class ; quit; Note the case dependencies, including caps for libname and memname and case sensitivity of variable names. S -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of Arthur Tabachneck Sent: Saturday, February 20, 2010 1:01 PM To: SAS-L(a)LISTSERV.UGA.EDU Subject: Can one access result of sql feedback option? While investigating one of this morning's posts, I was playing around with proc sql's feedback option. The original question was whether one could use a variable list in sql. Thus given data like: data have; input qtr Col1 Col2 Col15676 Col15677 Col15678 Col15679 Col15680 Col15681 Col15683 ColX; cards; 1 1 2 3 4 5 6 7 8 9 0 2 9 8 7 6 5 4 3 2 1 0 ; one could easily write something like the following to keep everything but ColX: %let qtr=1; proc sql feedback; select * from have (keep=Col1 Col2 Col15676-Col15681 Col15683) where qtr=&qtr. ; quit; SAS will put the full variable list into the log. Other than capturing and parsing the log, is there a direct way to access the variable names that SAS is obviously storing somewhere? The goal, in this case, would be to include those names in an into: statement. Art
|
Pages: 1 Prev: Concordance logistic regression SAS Next: How to remove BOTH duplicates in sort |