<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/tags/Datasets</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Sun, 19 May 2013 00:00:20 GMT</pubDate>
<item>
<title>(SAS) Random Sample Selection - sarathannapareddy</title>
<link>http://snipplr.com/view/34215/random-sample-selection/</link>
<description><![CDATA[ <p>Last week my manager asked me to randomly pick 10%observations from a large data set and then create a listing so that the Data management programmers can QC the data. I want to share some thoughts here … how easy and simple to do random sampling. 
Approach 1:

Data step Approach: In this approach, the observations are shuffled using the RANUNI function which assigns a random number to each observation.</p> ]]></description>
<pubDate>Tue, 11 May 2010 10:40:28 GMT</pubDate>
<guid>http://snipplr.com/view/34215/random-sample-selection/</guid>
</item>
<item>
<title>(SAS) CALL EXECUTE: Easy way to print or sort multiple files. - sarathannapareddy</title>
<link>http://snipplr.com/view/33199/call-execute-easy-way-to-print-or-sort-multiple-files/</link>
<description><![CDATA[ <p>When printing multiple files, or sorting multiple datasets, the traditional method is to write multiple steps as below.

Proc print data=libref.ae; var _all_; run;
Proc print data=libref.conmed; var _all_; run;
Proc print data=libref.demog; var _all_; run;
Proc print data=libref.lab; var _all_; run;
Proc print data=libref.medhist; var _all_; run; 
If you are like me who likes to simplify the traditional SAS code here is the tip. CALL EXECUTE comes to rescue here.</p> ]]></description>
<pubDate>Mon, 26 Apr 2010 19:42:48 GMT</pubDate>
<guid>http://snipplr.com/view/33199/call-execute-easy-way-to-print-or-sort-multiple-files/</guid>
</item>
<item>
<title>(SAS) How to delete previously assigned formats and informats of variables in the dataset - sarathannapareddy</title>
<link>http://snipplr.com/view/18187/how-to-delete-previously-assigned-formats-and-informats-of-variables-in-the-dataset/</link>
<description><![CDATA[ <p>How to delete previously assigned formats and informats completely from the SAS dataset:

PROC DATASETS lib=work;
MODIFY dsn;
FORMAT _all_;
INFORMAT _all_;
RUN; 
QUIT;</p> ]]></description>
<pubDate>Tue, 11 Aug 2009 16:26:20 GMT</pubDate>
<guid>http://snipplr.com/view/18187/how-to-delete-previously-assigned-formats-and-informats-of-variables-in-the-dataset/</guid>
</item>
<item>
<title>(SAS) Renaming All variables in the SAS dataset using SASHELP VIEWS/DICTIONARY.tables - sarathannapareddy</title>
<link>http://snipplr.com/view/17699/renaming-all-variables-in-the-sas-dataset-using-sashelp-viewsdictionarytables/</link>
<description><![CDATA[ <p>We can rename all the variables in the dataset using the SASHELP views or Dictionary.Tables... I.e SAS metadata...

here is how....</p> ]]></description>
<pubDate>Thu, 30 Jul 2009 13:12:57 GMT</pubDate>
<guid>http://snipplr.com/view/17699/renaming-all-variables-in-the-sas-dataset-using-sashelp-viewsdictionarytables/</guid>
</item>
<item>
<title>(SAS) Renaming All Variables in a SAS Data Set Using the SASHELP VIEWS - sarathannapareddy</title>
<link>http://snipplr.com/view/17378/renaming-all-variables-in-a-sas-data-set-using-the-sashelp-views/</link>
<description><![CDATA[ <p>*Create a temporary dataset... DSN;
data dsn;
a=1;
b=2;
c=3;
d=4;
e=5;
f=6;
run;


%macro test(lib,dsn);

*/1)*/ data _null_;
set sashelp.vtable(where=(libname="&amp;LIB" and memname="&amp;DSN"));
call symput('nvars',nvar);
run;

*/2)*/ data dsn;
set sashelp.vcolumn(where=(libname="&amp;LIB" and memname="&amp;DSN"));
call symput(cats("var",_n_),name);
run;

*/3)*/ proc datasets library=&amp;LIB;
modify &amp;DSN;
rename
%do i = 1 %to &amp;nvars;
&amp;&amp;var&amp;i=Rename_&amp;&amp;var&amp;i.
%end;
;
quit;
run;
%mend;

%test(WORK,DSN);

After submitting the above program... the output looks like this....


Output:
Rename_a Rename_b Rename_c Rename_d Rename_e Rename_f
1 2 3 4 5 6</p> ]]></description>
<pubDate>Thu, 23 Jul 2009 09:29:51 GMT</pubDate>
<guid>http://snipplr.com/view/17378/renaming-all-variables-in-a-sas-data-set-using-the-sashelp-views/</guid>
</item>
<item>
<title>(SAS) Clean-up: Delete temporary Datasets in work directory - sarathannapareddy</title>
<link>http://snipplr.com/view/15923/cleanup-delete-temporary-datasets-in-work-directory/</link>
<description><![CDATA[ <p>It is better always to clean-up/empty the work directory before we run the next set of SAS code. This is VERY helpful in situations where the “working” files created tend to use up a large amount of memory, once the logic of the program has been checked, KILLing the working files will result in a more efficient program. Another important reason to issue the above statement at the end of a program is when programs are run in batch, this will clean up the working library to be sure any “old” files are not left around to be erroneously used1.</p> ]]></description>
<pubDate>Sun, 14 Jun 2009 12:28:58 GMT</pubDate>
<guid>http://snipplr.com/view/15923/cleanup-delete-temporary-datasets-in-work-directory/</guid>
</item>
<item>
<title>(SAS) How to delete or remove previously assigned formats and informats completely from the SAS dataset: - sarathannapareddy</title>
<link>http://snipplr.com/view/15681/how-to-delete-or-remove-previously-assigned-formats-and-informats-completely-from-the-sas-dataset/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sun, 07 Jun 2009 22:20:18 GMT</pubDate>
<guid>http://snipplr.com/view/15681/how-to-delete-or-remove-previously-assigned-formats-and-informats-completely-from-the-sas-dataset/</guid>
</item>
<item>
<title>(SAS) Clean-Up: Delete datasets in the work library: - sarathannapareddy</title>
<link>http://snipplr.com/view/15680/cleanup-delete-datasets-in-the-work-library/</link>
<description><![CDATA[ <p></p> ]]></description>
<pubDate>Sun, 07 Jun 2009 22:17:55 GMT</pubDate>
<guid>http://snipplr.com/view/15680/cleanup-delete-datasets-in-the-work-library/</guid>
</item>
</channel>
</rss>