VARNUM checks whether the variable &name exists
Friday, May 20, 2011
Thursday, May 19, 2011
Modify the default ODS graphics behavior from statistical procedures
Those ODS graphics in the statistical procedures are predefined template using Graphics template language(GTL). Using ods trace on to find the name of that graph template. Then you have two ways to modify them.
split data
1000 size sample, variable: ID_no from 1-1000
how to split it to two new data sets: one with even numbers for ID_no, the othe one with odds number for ID_no?
data set1 set2;
set yourdata;
if mod(id, 2) = 0 then output set1;
else output set2;
run;
estimate statements
In your LSMEANS statement, add an option e, SAS should print out an estimate statement for you. That will be an excellent example.
write a sas dataset to a flat file
filename myfile "d:\temp\a.txt";
data _null_;
set mydata;
file myfile;
put id 1-3 var2 4-10 var3 11-15 ;
run;
change the default number of digits in P values
proc template;
edit Common.PValue;
format=best16.;
end;
run;
edit Common.PValue;
format=best16.;
end;
run;
download data with URL
FILENAME myurl URL "http://ichart.finance.yahoo.com/table.csv?s=&tic";
DATA &tic;
INFILE myurl FIRSTOBS=2 missover dsd;
format date yymmdd10.;
INPUT Date: yymmdd10. Open High Low Close Volume Adj_Close
;
if date>=today()-180;
RUN;
randomly select 300 samples
Proc Surveyselect
data=old data method=sys/srs/etc. sampsize=300 out=new data;
run;
data=old data method=sys/srs/etc. sampsize=300 out=new data;
run;
superscript to ODS RTF
Google is your best friend:
http://www2.sas.com/proceedings/forum2008/033-2008.pdf
ods rtf file="C:\test.rtf";
ods escapechar= '\';
proc tabulate data=sashelp.class style={cellwidth=100};
class sex;
var age;
table sex,age;
label age= "age\{super 1}";
run;
ods rtf close;
select statement example
SELECT (payclass);
WHEN ('monthly') amt=salary;
WHEN ('hourly') DO;
amt=hrlywage*min(hrs,40);
IF hrs>40 THEN PUT 'Check Timecard';
END; /* end of do */
OTHERWISE PUT 'Problem Observation';
END;
WHEN ('monthly') amt=salary;
WHEN ('hourly') DO;
amt=hrlywage*min(hrs,40);
IF hrs>40 THEN PUT 'Check Timecard';
END; /* end of do */
OTHERWISE PUT 'Problem Observation';
END;
Monday, May 16, 2011
concatenate a selected list of datasets
libname test 'C:\test2';
proc sql;
select 'test.'||memname into : dlist separated BY ' ' from dictionary.tables
where libname='TEST' and memname contains 'selection_rule';
quit;
data one;
set &dlist;
run;
proc sql;
select 'test.'||memname into : dlist separated BY ' ' from dictionary.tables
where libname='TEST' and memname contains 'selection_rule';
quit;
data one;
set &dlist;
run;
Subscribe to:
Posts (Atom)