<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sassygrrrl</title>
	<atom:link href="http://sassygrrrl.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sassygrrrl.com</link>
	<description>Just another auspiciouscoincidence.net site</description>
	<lastBuildDate>Thu, 08 Mar 2012 17:11:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Missing Form Check for a Longitudinal Data Study</title>
		<link>http://sassygrrrl.com/2011/07/22/222/</link>
		<comments>http://sassygrrrl.com/2011/07/22/222/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 15:35:26 +0000</pubDate>
		<dc:creator>sassygrrrl</dc:creator>
				<category><![CDATA[Proc SQL]]></category>
		<category><![CDATA[SAS]]></category>
		<category><![CDATA[SAS Macro Facility]]></category>
		<category><![CDATA[data cleaning]]></category>
		<category><![CDATA[longitudinal data]]></category>
		<category><![CDATA[survey data]]></category>

		<guid isPermaLink="false">http://sassygrrrl.nyctek.com/?p=222</guid>
		<description><![CDATA[* ---------------------------------------------------------------------------- ; * Our master file is based on our study enrollment form. Our initital cohort ; * consists of 200 participants. This program will identify which subjects are ; * missing subsequent forms. To properly assess this, we &#8230; <a href="http://sassygrrrl.com/2011/07/22/222/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<pre>
* ---------------------------------------------------------------------------- ;
* Our master file is based on our study enrollment form. Our initital cohort   ;
* consists of 200 participants. This program will identify which subjects are  ;
* missing subsequent forms. To properly assess this, we e must also identify   ;
* which subjects have passed away since study enrollment and thus exclude them ;
* from the reports to follow. ;
* ---------------------------------------------------------------------------- ;
* assign library;
libname febstat 'S:FEBSTATDatasets';

* ---------------------------------------------------------------------------- ;
* set global macro variables including where to write your output file.        ;
%let lib=FEBSTAT;                   %put lib=&amp;lib.                             ;
%let masterFile=T1H01;        %put masterFile=&amp;masterFile.                     ;
%let deceasedSrcFile=TRG03;   %put deceasedSrcFile=&amp;deceasedSrcFile.           ;
%let pdfDest=S:FEBSTATprogramst1hreportssubjectsMissingBaselineForms.pdf  ;
* ---------------------------------------------------------------------------- ;
* check to see when the dataset containing information on deceased subjects    ;
* was created (from a database pull)                                           ;
PROC SQL noprint;
       select datepart(crdate) format=mmddyy10. into:createDate
     from dictionary.tables
       where libname="&amp;lib." and memname="&amp;deceasedSrcFile";
QUIT;
%put createDate=&amp;createDate.;

* ---------------------------------------------------------------------------- ;
* set options including macro and format locations;
options nocenter nonumber nodate;

options mautosource sasautos='S:FEBSTATprogramsmacros';
options symbolgen mprint;

options fmtsearch=(febstat);

* ---------------------------------------------------------------------------- ;
* Flag deceased subjects;
data passed;
     set &amp;lib..&amp;deceasedSrcFile. (keep=iecnum idnum death
                                  rename=(death=subjectDeceased));
     if subjectDeceased=1;
run;

proc sort data=&amp;lib..&amp;masterFile. out=masterFile;
     by idnum;
run;

data masterFile; set &amp;lib..&amp;masterfile.(keep=iecnum idnum);
     in&amp;masterFile.=1;
run;

%macro merge(dset);
proc format;
     value yes
     1='Yes'
     .='No';
run;

proc sort data=&amp;lib..&amp;dset.;
     by idnum;
run; 

data &amp;dset.; set &amp;lib..&amp;dset (keep=iecnum idnum);
     in&amp;dset.=1;
run;

data &amp;dset.; merge masterFile(in=a) &amp;dset(in=b) passed (in=c);
     by idnum;
if a=1 and b^=1 and c^=1;
format in&amp;dset. &amp;dset. subjectDeceased yes.;
run;

*ods listing close;
ODS ESCAPECHAR='^';
ods proclabel="Missing &amp;dset.";
ods pdf body="&amp;pdfDest."
    style = sasweb
    startpage=yes;
footnote justify=right 'Page ^{thispage} of ^{lastpage}';

proc print data=&amp;dset.;
     var iecnum idnum in&amp;masterFile. in&amp;dset. subjectDeceased ;
title Subject Present in &amp;masterFile. but not &amp;dset.;
title2 As of &amp;createDate..;
run;
%mend merge;

* check for subjects missing from the following datasets;
%merge(T1H02)
%merge(T1H03)
%merge(T1H04)
%merge(T1H050)
%merge(T1H051)
%merge(T1H052)
%merge(T1H053)
%merge(T1H054)
%merge(T1H055)
%merge(T1H056)
%merge(T1H057)
%merge(T1H058)
%merge(T1H059a)
%merge(T1H059b)
%merge(T1H06)
%merge(T1H07)

ods pdf close;
ods listing;

* Clear results window and delete all datasets from the work library;
* Optional and not necessary when running in batch mode;
dm 'odsresults; clear';;
proc datasets library=work kill;
quit;</pre>
<p><a href="http://www.mediafire.com/?rrwjkr0zaef31">Download SAS Program</a><br />
<a href="http://www.mediafire.com/?35cvbjxe1vddw5b">View Sample Output</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sassygrrrl.com/2011/07/22/222/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generate a Create Date Macro Value For a Specific SAS Dataset</title>
		<link>http://sassygrrrl.com/2011/07/22/generate-a-create-date-macro-value-for-a-specific-sas-dataset/</link>
		<comments>http://sassygrrrl.com/2011/07/22/generate-a-create-date-macro-value-for-a-specific-sas-dataset/#comments</comments>
		<pubDate>Fri, 22 Jul 2011 14:24:40 +0000</pubDate>
		<dc:creator>sassygrrrl</dc:creator>
				<category><![CDATA[Proc SQL]]></category>
		<category><![CDATA[SAS]]></category>
		<category><![CDATA[SAS Macro Facility]]></category>
		<category><![CDATA[%put]]></category>
		<category><![CDATA[crdate]]></category>
		<category><![CDATA[datepart]]></category>
		<category><![CDATA[dictionary.tables]]></category>

		<guid isPermaLink="false">http://sassygrrrl.nyctek.com/?p=216</guid>
		<description><![CDATA[PROC SQL noprint; select datepart(crdate) format=mmddyy10. into:createDate from dictionary.tables where libname="LIB" and memname="DATASET"; QUIT; %put createDate=&#38;createDate.; Sample Log Output: SYMBOLGEN: Macro variable CREATEDATE resolves to 04/08/2011 2 3 %put createDate=&#38;createDate.; createDate=04/08/2011]]></description>
			<content:encoded><![CDATA[<p><code>PROC SQL noprint;<br />
       select datepart(crdate) format=mmddyy10. into:createDate<br />
     from dictionary.tables<br />
       where libname="LIB" and memname="DATASET";<br />
QUIT;</p>
<p>%put createDate=&amp;createDate.;</code></p>
<p>Sample Log Output:</p>
<p><code>SYMBOLGEN:  Macro variable CREATEDATE resolves to 04/08/2011<br />
2<br />
3  %put createDate=&amp;createDate.;<br />
createDate=04/08/2011</code></p>
]]></content:encoded>
			<wfw:commentRss>http://sassygrrrl.com/2011/07/22/generate-a-create-date-macro-value-for-a-specific-sas-dataset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generate Character Frequency Reports for Data Cleaning</title>
		<link>http://sassygrrrl.com/2011/07/20/generate-character-frequency-reports-for-data-cleaning/</link>
		<comments>http://sassygrrrl.com/2011/07/20/generate-character-frequency-reports-for-data-cleaning/#comments</comments>
		<pubDate>Wed, 20 Jul 2011 19:02:07 +0000</pubDate>
		<dc:creator>sassygrrrl</dc:creator>
				<category><![CDATA[SAS Macro Facility]]></category>
		<category><![CDATA[character variables]]></category>
		<category><![CDATA[data cleaning]]></category>
		<category><![CDATA[strings]]></category>

		<guid isPermaLink="false">http://sassygrrrl.nyctek.com/?p=207</guid>
		<description><![CDATA[An email I sent to a colleague describing how to use the program below: Attached is a program which help you look for inconsistencies in how the character data was entered (i.e. Not applicable vs N/A vs Not Applicable) and &#8230; <a href="http://sassygrrrl.com/2011/07/20/generate-character-frequency-reports-for-data-cleaning/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>An email I sent to a colleague describing how to use the program below:</p>
<blockquote><p>Attached is a program which help you look for inconsistencies in how the character data was entered (i.e. Not applicable vs N/A vs Not Applicable) and so on.  Another thing that it will do is that it will let you know how many records are missing values if you wanted  to do a global N/A or something of that nature.</p>
<p>The program will work on any SAS dataset.  It automatically runs a frequency of values on every character variable (string) in a given dataset.  Some of the long more narrative text fields you&#8217;ll likely just want to ignore.  (When it comes time for analysis someone will have a lot of fun reading those long explanations and coming up with ways to code them. Did you ever have the pleasure of studying content analysis or text mining?) <img src='http://sassygrrrl.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The program creates an individual report per dataset but I bound them into a single PDF to make it easier to send to you.</p>
<p>Please let me know if you have any questions.  The most important things to remember are:</p>
<ul>
<li>DO NOT EDIT THE MACRO IF YOU ARE NOT 100% SURE WHAT TO DO</li>
<li>Keep an original copy of the program to go back to on the off chance that a stray keystroke breaks something.</li>
</ul>
<p>All you need to do to get this program to work is to assign a library (i.e. point SAS to the datasets) and tell SAS what directory to dump your PDFs into. For convenience that is set with a global macro variable at the top.  (I try to set parameters above the bulk of the code to help maintain the integrity of the actual program.)</p>
<p>The last section of the program executes the macro against a given dataset.  You can comment out a single line with an asterisk at the start of the line or separate out a block using /* and */.</p></blockquote>
<pre>
*------------------------------------------------------------;
* Set options and parameters                                 ;
*------------------------------------------------------------;
options mprint symbolgen ;
options nonumber nodate nocenter nosource spool; 

* Path to output;
%let pdfDest=S:FEBSTATReportsMisc Reports;
* Set library;
libname febstat "S:FEBSTATDatasets";

*------------------------------------------------------------;
* The macro (essentially a subroutine) - DO NOT MODIFY       ;
* The "dset" variable is where you assign the dataset you    ;
* wish to process.                                           ;
*------------------------------------------------------------;

%macro charFreq(dset=);
dm 'odsresults; cancel';
proc datasets library = work nolist;
    modify &amp;dset.;
      attrib _all_ label='';
quit;

proc contents data=&amp;dset. varnum out=foo (where=(type=2 and name not in('IDNUM','SUBINIT'))
                                          keep=name type varnum) noprint;
run;

proc sort data=foo;
     by varnum;
run;

data _null_;
    retain N 0;
    set foo(keep=name) end=last;
    call symput("name"||trim(left(_N_)),compress(NAME));
    if last then call symput('N',trim(left(_N_)));
run;

ods listing close;
ods pdf body="&amp;pdfDest.&amp;dset._charFreq.pdf"
        style=sasweb
        startpage=yes;
    %do printLoop = 1 %to &amp;N.;
        ods proclabel="&amp;&amp;name&amp;printLoop";
        proc freq data=&amp;dset.;
             tables &amp;&amp;name&amp;printLoop / list out=&amp;&amp;name&amp;printLoop nocum nopercent;
	         title &amp;&amp;name&amp;printLoop (Unique Values);
        run;

        proc datasets lib=work nolist;
             delete &amp;&amp;name&amp;printLoop;
        quit;
   %end;
ods pdf close;
ods listing;
title;
%mend charFreq;

*------------------------------------------------------------;
* Execute program;
*------------------------------------------------------------;

%charFreq(dset=LIBNAME.FOO);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sassygrrrl.com/2011/07/20/generate-character-frequency-reports-for-data-cleaning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAS Macros To Create .CSV Output Using Proc Export</title>
		<link>http://sassygrrrl.com/2011/06/30/sas-macros-to-create-csv-output-using-proc-export/</link>
		<comments>http://sassygrrrl.com/2011/06/30/sas-macros-to-create-csv-output-using-proc-export/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 17:06:56 +0000</pubDate>
		<dc:creator>sassygrrrl</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[SAS Macro Facility]]></category>
		<category><![CDATA[.csv]]></category>
		<category><![CDATA[capture/recapture]]></category>
		<category><![CDATA[macros]]></category>
		<category><![CDATA[proc export]]></category>

		<guid isPermaLink="false">http://sassygrrrl.nyctek.com/?p=200</guid>
		<description><![CDATA[This program exports the ID and site information for Capture-Recapture Analysis of subjects in a longitudinal data study using R. The dynamic .CSV export macro loops through the numeric values of a given variable in a dataset using that value &#8230; <a href="http://sassygrrrl.com/2011/06/30/sas-macros-to-create-csv-output-using-proc-export/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This program exports the ID and site information for Capture-Recapture Analysis of subjects in a longitudinal data study using R. The dynamic <kbd>.CSV</kbd> export macro loops through the numeric values of a given variable in a dataset using that value to both subset the data and modify the output file&#8217;s name.</p>
<pre>
libname ks "S:nfoxKansasDatasetsPERK";<br />
libname kansas "S:nfoxKansasDatasets"; *formats are saved here;<br />
options fmtsearch=(kansas);</p>
<p>* ------------------------------------------------------------------------------- ;<br />
* Create Macros for CSV file export ;<br />
* ------------------------------------------------------------------------------- ;<br />
%macro exportCSV(dset=,where=,outfile=,drop=gender VAR2);<br />
DATA FOO(drop=&amp;drop.);<br />
     SET &amp;dset. (where=(&amp;where.));<br />
RUN;<br />
PROC EXPORT DATA=FOO<br />
            OUTFILE=&amp;outfile.<br />
            DBMS=CSV REPLACE;<br />
     PUTNAMES=YES;<br />
RUN;<br />
%mend exportCSV;</p>
<p>%macro exportDynamicCSV;<br />
%do exportLoop = 1 %to 4;<br />
%exportCSV(where=ageGroup2=&amp;exportLoop.,<br />
           outfile="S:nfoxKansasProgramscapturecaptureKS-ageGroup&amp;exportLoop..csv");<br />
%end;<br />
%mend exportDynamicCSV;</p>
<p>* ------------------------------------------------------------------------------- ;<br />
* Recode site-related data for Capture Analysis ;<br />
* ------------------------------------------------------------------------------- ;<br />
data ks.ids;<br />
     retain idnum stf_id1 site1 stf_id2 recap1 stf_id3 recap2 stf_id4 recap3<br />
                  stf_id5 recap4 stf_id6 recap5;<br />
     length site1 recap1-recap5 3;<br />
     set ks.stf (keep=idnum stf_id1-stf_id6 stf_14 stf_15 stf_4 fd_7 ageGroup gender);</p>
<p>     year=scan(stf_15,-1);</p>
<p>     if fd_7=1 and (stf_14=0 or (stf_14=1 and year &gt;= 2008)) and stf_4<br />
         in('66757','67301','67333','67335','67337','67340','67344','67347',<br />
        '67351','67363','67364','66753','67330','67332','67335','67336',<br />
        '67337','67341','67342','67351','67354','67356','67357');</p>
<p>     site1=scan(stf_ID1,1,'-');</p>
<p>	 array recap {5} recap1-recap5;<br />
     array sites {5} stf_ID2-stf_ID6;</p>
<p>     do i = 1 to 5;<br />
	    if sites{i} ne '-999' then do;<br />
	        recap{i}=scan(sites{i},1,'-');<br />
			if site1=recap{i} then recap{i} = -999;<br />
		end;<br />
		if sites{i} eq '-999' then do;<br />
	        recap{i}=sites{i};<br />
		end;<br />
     end;</p>
<p>	 if recap2 ne -999 then do;<br />
	    if recap2 = site1 then recap2=-999;<br />
        if recap2 = recap1 then recap2=-999;<br />
	 end;</p>
<p>	 if recap3 ne -999 then do;<br />
	    if recap3 = site1 then recap3=-999;<br />
        if recap3 = recap1 then recap3=-999;<br />
		if recap3 = recap2 then recap3=-999;<br />
	 end;</p>
<p>	 if recap4 ne -999 then do;<br />
	    if recap4 = site1 then recap4=-999;<br />
        if recap4 = recap1 then recap4=-999;<br />
		if recap4 = recap2 then recap4=-999;<br />
		if recap4 = recap3 then recap4=-999;<br />
	 end;</p>
<p>     if recap5 ne -999 then do;<br />
	    if recap5 = site1 then recap5=-999;<br />
        if recap5 = recap1 then recap5=-999;<br />
		if recap5 = recap2 then recap5=-999;<br />
		if recap5 = recap3 then recap5=-999;<br />
		if recap5 = recap4 then recap5=-999;<br />
	 end;</p>
<p>	 IF AGEGROUP IN(1,2) THEN AGEGROUP2=1;<br />
	 IF AGEGROUP IN(3,4) THEN AGEGROUP2=2;<br />
	 IF AGEGROUP IN(5,6) THEN AGEGROUP2=3;<br />
	 IF AGEGROUP &gt;=7     THEN AGEGROUP2=4;</p>
<p>drop i stf_id1-stf_id6 stf_14 stf_15 stf_4 fd_7 year ageGroup;<br />
run;</p>
<p>* ------------------------------------------------------------------------------- ;<br />
* Call Macros and export CSV files ;<br />
* ------------------------------------------------------------------------------- ;<br />
%exportCSV(where=1      ,outfile="S:nfoxKansasProgramscapturecaptureKS.csv")<br />
%exportCSV(where=gender=1,outfile="S:nfoxKansasProgramscapturecaptureKS-malePop.csv")<br />
%exportCSV(where=gender=2,outfile="S:nfoxKansasProgramscapturecaptureKS-fmPop.csv")<br />
%exportDynamicCSV</p>
]]></content:encoded>
			<wfw:commentRss>http://sassygrrrl.com/2011/06/30/sas-macros-to-create-csv-output-using-proc-export/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing Shell Scripts to Run SAS using Cygwin</title>
		<link>http://sassygrrrl.com/2011/06/09/developing-shell-scripts-to-run-sas-using-cygwin/</link>
		<comments>http://sassygrrrl.com/2011/06/09/developing-shell-scripts-to-run-sas-using-cygwin/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 14:10:38 +0000</pubDate>
		<dc:creator>sassygrrrl</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PC]]></category>

		<guid isPermaLink="false">http://sassygrrrl.afterculture.net/?p=186</guid>
		<description><![CDATA[An article describing how to set up SAS to run in Cygwin shell scripts hosted at Data Savant Consulting: Linking to SAS Unix has got to find SAS, somehow, if you have SAS on your PC. You can add the &#8230; <a href="http://sassygrrrl.com/2011/06/09/developing-shell-scripts-to-run-sas-using-cygwin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>An <a href="http://www.datasavantconsulting.com/roland/cygwin.html">article</a> describing how to set up SAS to run in Cygwin shell scripts hosted at <a href="http://www.datasavantconsulting.com/">Data Savant Consulting</a>:</p>
<blockquote><p><strong>Linking to SAS</strong></p>
<p>Unix has got to find SAS, somehow, if you have SAS on your PC. You can add the directory with the sas executable (<code>sas.exe</code>) to the end of the <code>PATH</code> like this:</p>
<p><code>PATH=$PATH:/cygdrive/c/shellscripts:/cygdrive/c/PROGRA~1/SASINS~1/SAS/v8</code></p>
<p>Note that because Unix will not accept spaces in directory names, you have to use the pure DOS notation for some of the directories. You can see that I have done this for &#8220;Program Files&#8221; and &#8220;SAS Institute&#8221;.</p>
<p><strong>Running SAS in batch</strong></p>
<p>Some of the shell scripts on this site run SAS in batch. It is supposed to be done discretely so that the user is not aware that they are running sas. In order to suppress the pop-up windows you get with PC sas then you can disable them using the following options:</p>
<p><code>sas -nosplash -nologo -icon</code></p>
<p>When you call sas in one of your scripts then set these options to suppress the windows. I do not know of a shorthand way of doing this. There is no point setting up an alias in your .<code>bashrc</code> as this will not get exported to any sub-processes like you get for a shell script.</p>
<p>The second problem running SAS in batch is that it will have is locating the program files. Your PC sas will not understand the Unix directory structure. It will expect a DOS file name. The scripts I write that call SAS, generate program code in my home directory and then invokes SAS to run the code. I have set up a HOMEW variable in my <code>.bashrc</code> and exported it so that I can use it in shell scripts.</p>
<p><code>HOMEW=C:cygwinhomeDefault<br />
export HOMEW</code></p>
<p>In the shell script I then use <code>$HOMEW </code>as both the destination of the log and to indicate where the program code is stored.</p>
<p><code># Run the SAS code<br />
sas -nosplash -nologo -icon -log "$HOMEW" -sysin "$HOMEWcontents.sas"</code></p>
<p>If you are developing shell scripts that call SAS on your PC and they are intended eventually for a Unix platform then you have to change <code>$HOMEW</code> to <code>$HOME </code>and change the backslash to a forward slash in the program location. You may have to remove the &#8220;<code>-nosplash -nologo -icon</code>&#8221; options as well.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://sassygrrrl.com/2011/06/09/developing-shell-scripts-to-run-sas-using-cygwin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Print Loop Macro</title>
		<link>http://sassygrrrl.com/2011/06/08/185/</link>
		<comments>http://sassygrrrl.com/2011/06/08/185/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 20:13:57 +0000</pubDate>
		<dc:creator>sassygrrrl</dc:creator>
				<category><![CDATA[Output Delivery System (ODS)]]></category>
		<category><![CDATA[SAS]]></category>
		<category><![CDATA[SAS Macro Facility]]></category>
		<category><![CDATA[data cleaning]]></category>

		<guid isPermaLink="false">http://sassygrrrl.afterculture.net/?p=185</guid>
		<description><![CDATA[Output Data Cleaning Reports by Table Name and ID %macro printLoop(dset=,pdfDest=,rpt=); data _null_; retain N 0; set &#38;dset. (keep=idnum iecnum) end=last; call symput("iecnum"&#124;&#124;trim(left(_N_)),compress(iecnum)); call symput("idnum"&#124;&#124;trim(left(_N_)),compress(idnum)); if last then call symput('N',trim(left(_N_))); run; %do printLoop = 1 %to &#38;N.; data foo; set &#8230; <a href="http://sassygrrrl.com/2011/06/08/185/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Output Data Cleaning Reports by Table Name and ID</p>
<p><code>%macro printLoop(dset=,pdfDest=,rpt=);<br />
data _null_;<br />
     retain N 0;<br />
     set &amp;dset. (keep=idnum iecnum) end=last;<br />
     call symput("iecnum"||trim(left(_N_)),compress(iecnum));<br />
     call symput("idnum"||trim(left(_N_)),compress(idnum));<br />
     if last then call symput('N',trim(left(_N_)));<br />
run;</p>
<p>%do printLoop = 1 %to &amp;N.;<br />
data foo; set &amp;dset.(where=(idnum="&amp;&amp;idnum&amp;printLoop"));<br />
run;</p>
<p>ods pdf body  = "&amp;pdfDest.&amp;d._&amp;&amp;idnum&amp;printLoop...pdf"<br />
        style = sasweb<br />
        bookmarkgen=yes<br />
        startpage=yes<br />
        author="Columbia University Medical Center";</p>
<p>%inc &amp;rpt.;</p>
<p>ods pdf close;<br />
%end;<br />
%mend printLoop;</code></p>
<p><a href="http://dl.dropbox.com/u/890523/SAS%20Examples/printLoop.sas">Download SAS Program</a></p>
<p>To Output Data Cleaning Reports by Site, Table Name, and ID replace the PDF statement in the program with this statement below:</p>
<p><code>ods pdf body  = "&amp;pdfDest.&amp;&amp;iecnum&amp;printLoop&amp;d._&amp;&amp;idnum&amp;printLoop...pdf"</code> </p>
]]></content:encoded>
			<wfw:commentRss>http://sassygrrrl.com/2011/06/08/185/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Program to Check for Variable Length Discrepancies Among Datasets</title>
		<link>http://sassygrrrl.com/2011/06/08/program-to-check-for-variable-length-discrepancies-among-datasets/</link>
		<comments>http://sassygrrrl.com/2011/06/08/program-to-check-for-variable-length-discrepancies-among-datasets/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 17:46:19 +0000</pubDate>
		<dc:creator>sassygrrrl</dc:creator>
				<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://sassygrrrl.afterculture.net/?p=182</guid>
		<description><![CDATA[libname archive 'S:pathtosaslib'; proc datasets lib=archive; contents data=_all_ out=work.foo(keep=memname name length where=(name in('IDNUM','SUBINIT'))); quit; proc sort data=foo; by name; run; ods listing; ods pdf file="S:pathtooutput.pdf" style=sasweb; proc report data=foo nowd; by name; column memname name length; define memname / display; &#8230; <a href="http://sassygrrrl.com/2011/06/08/program-to-check-for-variable-length-discrepancies-among-datasets/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><code>libname archive 'S:pathtosaslib';</p>
<p>proc datasets lib=archive;<br />
         contents data=_all_<br />
         out=work.foo(keep=memname name length<br />
         where=(name in('IDNUM','SUBINIT')));<br />
quit;</p>
<p>proc sort data=foo;<br />
         by name;<br />
run;</p>
<p>ods listing;<br />
ods pdf file="S:pathtooutput.pdf"<br />
             style=sasweb;</p>
<p>proc report data=foo nowd;<br />
         by name;<br />
         column memname name length;<br />
         define memname / display;<br />
         define name / display ;<br />
        define length / display ;<br />
title 'Variable Length Discrepancies Among Datasets';<br />
title2 'March 25th, 2011 Data Release';<br />
run;<br />
ods pdf close;<br />
</code></p>
<p><a href="http://dl.dropbox.com/u/890523/SAS%20Examples/checkIDnumVarLength.sas">Download SAS Program</a><br />
<a href="http://dl.dropbox.com/u/890523/SAS%20Examples/variableLengthDiscrepancies.pdf">View Output</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sassygrrrl.com/2011/06/08/program-to-check-for-variable-length-discrepancies-among-datasets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create .CSV File Documenting SAS Dataset Creation Dates</title>
		<link>http://sassygrrrl.com/2011/06/08/create-csv-file-documenting-sas-dataset-creation-dates/</link>
		<comments>http://sassygrrrl.com/2011/06/08/create-csv-file-documenting-sas-dataset-creation-dates/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 17:15:57 +0000</pubDate>
		<dc:creator>sassygrrrl</dc:creator>
				<category><![CDATA[Proc SQL]]></category>
		<category><![CDATA[SAS]]></category>
		<category><![CDATA[SAS Macro Facility]]></category>
		<category><![CDATA[crdate]]></category>
		<category><![CDATA[dictionary.tables]]></category>
		<category><![CDATA[memname]]></category>

		<guid isPermaLink="false">http://sassygrrrl.afterculture.net/?p=180</guid>
		<description><![CDATA[Generating Paths Based on Dictionary.Tables memname &#38; crdate %let basearchivepath=S:pathtodatasets; %let pathLabel=New Cohort SAS Datasets; %put base=&#38;basearchivepath. label=&#38;pathLabel.; libname febstat 'S:pathtoSASlib'; PROC SQL noprint; create table foo as select memname, crdate from dictionary.tables where libname="FEBSTAT" order by crdate; QUIT; data &#8230; <a href="http://sassygrrrl.com/2011/06/08/create-csv-file-documenting-sas-dataset-creation-dates/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Generating Paths Based on Dictionary.Tables memname &amp; crdate<br />
<code>%let basearchivepath=S:pathtodatasets;<br />
%let pathLabel=New Cohort SAS Datasets;<br />
%put base=&amp;basearchivepath. label=&amp;pathLabel.;</p>
<p>libname febstat 'S:pathtoSASlib';</p>
<p>PROC SQL noprint;<br />
   create table foo as<br />
   select memname, crdate<br />
   from   dictionary.tables<br />
   where  libname="FEBSTAT"<br />
   order by crdate;<br />
QUIT;</p>
<p>data foo;<br />
     set foo;<br />
length Path $255;<br />
label createDate = 'Create Date'<br />
      memname = 'Dataset (Member) Name'<br />
      Path = 'Path to Data';<br />
createDate=datepart(crdate);<br />
fmtDate=put(createDate,yymmdd10.);<br />
path="&amp;basearchivepath."||compress(fmtDate) ||""||"&amp;pathLabel.";<br />
format createDate yymmdd10.;<br />
drop crdate fmtDate;<br />
run;</p>
<p>proc sort data=foo;<br />
     by memname createDate;<br />
run;</p>
<p>ods listing close;<br />
ods csv file="pathtooutput.csv";<br />
 proc print data=foo noobs label;<br />
      var memname createDate Path;<br />
 run;<br />
ods csv close ;<br />
ods listing;</code></p>
<p><a href='http://dl.dropbox.com/u/890523/SAS%20Examples/checkCreateDate.sas'>Download SAS Program</a><br />
<a href='http://dl.dropbox.com/u/890523/SAS%20Examples/Data%20Release%20Date%20Folder%20Location%20Summary.csv'>View Output</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sassygrrrl.com/2011/06/08/create-csv-file-documenting-sas-dataset-creation-dates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Missing Data Summary Macro</title>
		<link>http://sassygrrrl.com/2011/05/23/missing-data-summary-macro/</link>
		<comments>http://sassygrrrl.com/2011/05/23/missing-data-summary-macro/#comments</comments>
		<pubDate>Mon, 23 May 2011 15:53:20 +0000</pubDate>
		<dc:creator>sassygrrrl</dc:creator>
				<category><![CDATA[SAS]]></category>
		<category><![CDATA[SAS Macro Facility]]></category>
		<category><![CDATA[missing]]></category>
		<category><![CDATA[missing data]]></category>

		<guid isPermaLink="false">http://sassygrrrl.afterculture.net/?p=163</guid>
		<description><![CDATA[%macro missingDataSummary(dset=); ods listing close; ods pdf body="&#38;pdfDest.&#38;dset._missing.pdf"; proc contents data=&#38;dset. varnum out=foo(keep=name) noprint; run; data _null_; retain N 0; set foo end=last; call symput("name"&#124;&#124;trim(left(_N_)),compress(NAME)); if last then call symput('N',trim(left(_N_))); run; %let obs = ''; data foo; set &#38;dset.; format &#8230; <a href="http://sassygrrrl.com/2011/05/23/missing-data-summary-macro/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><code>%macro missingDataSummary(dset=);<br />
ods listing close;<br />
ods pdf body="&amp;pdfDest.&amp;dset._missing.pdf";</p>
<p>proc contents data=&amp;dset. varnum out=foo(keep=name) noprint;<br />
run;</p>
<p>data _null_;<br />
    retain N 0;<br />
    set foo end=last;<br />
    call symput("name"||trim(left(_N_)),compress(NAME));<br />
    if last then call symput('N',trim(left(_N_)));<br />
run;</p>
<p>%let obs = '';</p>
<p>data foo; set &amp;dset.;<br />
format _numeric_ missing. _character_ $mischar.;<br />
run;</p>
<p>data miss; set foo;<br />
     %do printLoop = 1 %to &amp;N.;<br />
         if missing(&amp;&amp;name&amp;printLoop) then output;<br />
	 keep &amp;&amp;name&amp;printLoop;<br />
     %end; *close printLoop;<br />
keep iecnum idnum;<br />
run;</p>
<p>proc sort data=miss nodup;<br />
     by idnum;<br />
run;</p>
<p>proc sql noprint;<br />
     select count(*) into: obs<br />
     from WORK.miss;<br />
quit;</p>
<p>%if &amp;obs &gt; 0 %then %do;<br />
proc contents data=miss varnum out=miss2(keep=name) noprint;<br />
run;</p>
<p>data _null_;<br />
     retain N 0;<br />
     set miss2 end=last;<br />
     call symput("name"||trim(left(_N_)),compress(NAME));<br />
     if last then call symput('N',trim(left(_N_)));<br />
run;</p>
<p>     %do printLoop = 1 %to &amp;N.;<br />
         ods proclabel="&amp;&amp;name&amp;printLoop";<br />
         proc print data=miss noobs;<br />
              where missing(&amp;&amp;name&amp;printLoop);<br />
              var iecnum idnum &amp;&amp;name&amp;printLoop;<br />
 	          title Missing &amp;dset Data: &amp;&amp;name&amp;printLoop;<br />
         run;<br />
      %end;<br />
%end;<br />
ods pdf close;<br />
ods listing;<br />
title;<br />
%mend missingDataSummary;</code></p>
<p><a href="http://dl.dropbox.com/u/890523/SAS%20Examples/missingDataSummary.sas">Download SAS Program</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sassygrrrl.com/2011/05/23/missing-data-summary-macro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>View the Contents of a Format Library</title>
		<link>http://sassygrrrl.com/2011/05/23/view-the-contents-of-a-format-library/</link>
		<comments>http://sassygrrrl.com/2011/05/23/view-the-contents-of-a-format-library/#comments</comments>
		<pubDate>Mon, 23 May 2011 15:51:11 +0000</pubDate>
		<dc:creator>sassygrrrl</dc:creator>
				<category><![CDATA[Proc Format]]></category>
		<category><![CDATA[SAS]]></category>
		<category><![CDATA[format]]></category>

		<guid isPermaLink="false">http://sassygrrrl.afterculture.net/?p=162</guid>
		<description><![CDATA[* View the contents of an format library; proc catalog catalog = febstat.formats; contents; run; quit; * Examine the values of specific format in the library; proc format library = febstat.formats; select gender; run; quit; *To print out a saved &#8230; <a href="http://sassygrrrl.com/2011/05/23/view-the-contents-of-a-format-library/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><code>* View the contents of an format library;<br />
proc catalog catalog = febstat.formats;<br />
contents;<br />
run;<br />
quit;</code></p>
<p><code>* Examine the values of specific format in the library;<br />
proc format library = febstat.formats;<br />
select gender;<br />
run;<br />
quit;</code></p>
<p><code>*To print out a saved FORMAT library, use the FMTLIB option as indicated:<br />
libname library;<br />
proc format library=library fmtlib;<br />
run;</code></p>
<p><a href="http://dl.dropbox.com/u/890523/SAS%20Examples/checkFormatLib.sas">Download SAS Program</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sassygrrrl.com/2011/05/23/view-the-contents-of-a-format-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

