sas - retrieve data with a proc print or a sql query or else -
i'm looking advice on one. context before.
i have next table on sas. there 711 observations , many more variables. below sample table.
date col1 col2 col3 jun14 0 0 0 may14 1 0 2 apr14 1 0 3
the table has no index, no primary key , nothing.
the results i'm aiming for, know specific date, values of column.
date col1 col2 col3 may14 1 0 2 apr14 1 0 3
example may 14, have
i'm running next sql query on it
proc sql; select * mytable date < (input('may14',monyy5.));
as can imagine, query heavy when have many variables , many observations. query started 50 minutes ago , still running.
i thought using proc print
proc print data=mytable; var date col1 col2 col3; date = (input('may14',monyy5.)); run;
so here question.
is there other way have results rather through query or proc print? need have datastep transpose , although if i'm doing transpose, things different (see below).
date jun14 may14 apr14 col1 0 1 1 col2 0 0 0 col3 0 2 3
thanks in advance insight.
aren't missing quit;
after select
statement end proc sql
? can't believe take such time 771 records.
edit:
so problem in creating , displaying output straight in sas windows.
below log test proc printto direct output text file. takes less 10 seconds. size of file 100mb 1000 records , 10000 variables.
obviously, create more sense output info other formats. also, what's utilize of presenting thousands of values user?
114 info mytable ; 115 format date date9.; 116 array var {10000}; 117 i=1 10000; 118 var(i)=i; note: array var has same name sas-supplied or user-defined function. parentheses next name treated array references , not function references. 119 end; 120 i=1 1000; 121 date = i; 122 output; 123 end; 124 run; note: info set work.mytable has 1000 observations , 10002 variables. note: info statement used (total process time): real time 0.13 seconds cpu time 0.12 seconds 125 126 ods html close;* no html output; 127 ods listing; *text output rather; 128 129 proc printto print="e:\sasoutput.lst";run; note: procedure printto used (total process time): real time 0.00 seconds cpu time 0.00 seconds 129! * output file; 130 proc sql; 131 select * mytable date < '1may2014'd; 132 ; 133 quit; note: procedure sql used (total process time): real time 9.35 seconds cpu time 8.57 seconds 134 135 %put &sqlobs; 1000
sql sas
No comments:
Post a Comment