<?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>philihp.com &#187; Formats</title>
	<atom:link href="http://www.philihp.com/blog/tag/formats/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.philihp.com/blog</link>
	<description>I do things, and then I tell the internet about them.</description>
	<lastBuildDate>Mon, 06 Feb 2012 05:40:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Easy Inserting/Appending Libraries into FMTSEARCH path lists in SAS 9.2</title>
		<link>http://www.philihp.com/blog/2009/easy-insertingappending-libraries-into-fmtsearch-path-lists-in-sas-9-2/</link>
		<comments>http://www.philihp.com/blog/2009/easy-insertingappending-libraries-into-fmtsearch-path-lists-in-sas-9-2/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 21:49:50 +0000</pubDate>
		<dc:creator>philihp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[FMTSEARCH]]></category>
		<category><![CDATA[Formats]]></category>
		<category><![CDATA[SAS]]></category>
		<category><![CDATA[SAS 9.2]]></category>
		<category><![CDATA[SASAUTOS]]></category>

		<guid isPermaLink="false">http://www.philihp.com/blog/?p=507</guid>
		<description><![CDATA[In SAS 9.1.3 and prior, Options list (such as FMTSEARCH for libraries with format catalogs, and SASAUTOS for paths that contain macros shared across jobs) were annoying to work with. If you have nested code that wants to add a library or a path the list, doing so like this could potentially clobber statements executed [...]]]></description>
			<content:encoded><![CDATA[<p>In SAS 9.1.3 and prior, Options list (such as FMTSEARCH for libraries with format catalogs, and SASAUTOS for paths that contain macros shared across jobs) were annoying to work with. If you have nested code that wants to add a library or a path the list, doing so like this could potentially clobber statements executed outside of the nested block:</p>
<pre>OPTIONS FMTSEARCH=(<i>mylib.formats</i>);</pre>
<p>To really be safe, you want to add your library to the list. Doing this wasn&#8217;t very intuitive. I had always done this like this:</p>
<pre>%let FMTSEARCH = %substr(%sysfunc(getoption(fmtsearch) ) ,2);
OPTIONS FMTSEARCH = (<i>mylib.formats</i> &FMTSEARCH;</pre>
<p>But in 9.2, there are two new System Options, <a href="http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a003273966.htm">INSERT=</a> and <a href="http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a003273971.htm">APPEND=</a>. This is now as simple as</p>
<pre>OPTIONS INSERT=(FMTSEARCH=<i>mylib.formats</i>);</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.philihp.com/blog/2009/easy-insertingappending-libraries-into-fmtsearch-path-lists-in-sas-9-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing formats from all variables in a SAS Dataset</title>
		<link>http://www.philihp.com/blog/2009/removing-formats-from-all-variables-in-a-sas-dataset/</link>
		<comments>http://www.philihp.com/blog/2009/removing-formats-from-all-variables-in-a-sas-dataset/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 20:42:48 +0000</pubDate>
		<dc:creator>philihp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Formats]]></category>
		<category><![CDATA[SAS]]></category>

		<guid isPermaLink="false">http://www.philihp.com/blog/?p=476</guid>
		<description><![CDATA[In SAS, every field/variable in a table/dataset can be given a format. This format tells SAS how to display the data. The following datastep will create a table called &#8220;formatted&#8221; having 1 row containing 3 variables: x, y, and d. data formatted; x=9000; y=42; now=16761; format x comma6.; format y dollar5.; format now date7.; put [...]]]></description>
			<content:encoded><![CDATA[<p>In SAS, every field/variable in a table/dataset can be given a format. This format tells SAS how to display the data. The following datastep will create a table called &#8220;formatted&#8221; having 1 row containing 3 variables: x, y, and d.</p>
<pre>data formatted;
  x=9000;
  y=42;
  now=16761;
  format x comma6.;
  format y dollar5.;
  format now date7.;
  put x=;
  put y=;
  put now=;
run;</pre>
<p>Additionally it prints to the log the formatted values.</p>
<pre>x=9,000
y=$42
now=21NOV05</pre>
<p>In SAS you can also create your own formats, and you can assign these formats to whichever datasets you like. However if that format goes away for some reason and you try to look at the data again, you will get this error:</p>
<pre>ERROR: Informat $YOURFMT not found or couldn't be loaded for variable YOURVAR.</pre>
<p>You can get around this by turning off this option</p>
<pre>options nofmterr;</pre>
<p>Then your ERROR turns into NOTE, and things work normally, except when you try to view the data you see it unformatted. This could be useful, however, if you find yourself in a situation like this:</p>
<pre>data _null_;
  a=20.0000001;
  b=20.000001;
  format a dollar4.2;
  format b dollar4.2;
  put a= b=;
  if(a=b) then put 'matches';
   else put 'no match';
run;</pre>
<p>Runs and outputs:</p>
<pre>a=20.0 b=20.0
no match</pre>
<p>At any rate, there are times in SAS when you simply want to remove all the formats from a dataset. This can be done in one line in a datastep:</p>
<pre>
data unformatted;
  set formatted;
  format _all_;
run;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.philihp.com/blog/2009/removing-formats-from-all-variables-in-a-sas-dataset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

