<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Formats Not Recognized in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411237#M3903</link>
    <description>&lt;P&gt;Ok, that makes sense. However I tried doing it like this and it still did not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format&lt;BR /&gt;library&amp;nbsp;= HypTabs.HypFormats;&lt;/P&gt;&lt;P&gt;value&amp;nbsp;CODCd&lt;BR /&gt;. = 'Unknown'&lt;BR /&gt;1 = 'Heart Disease'&lt;BR /&gt;2 = 'Heart Failure'&lt;BR /&gt;3 = 'Stroke'&lt;BR /&gt;4 = 'Other COD'&lt;BR /&gt;OTHER = 'Unanticipated Value';&lt;BR /&gt;&lt;BR /&gt;value&amp;nbsp;HypRelDeathInd&lt;BR /&gt;. = 'Unknown'&lt;BR /&gt;0 = 'No'&lt;BR /&gt;1 = 'Yes'&lt;BR /&gt;OTHER = 'Unexpected Value';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data&amp;nbsp;HypTabs.NDI (LABEL = "Death Data");&lt;BR /&gt;retain&amp;nbsp;SSN DeathDt ICD10 COCd HypRelDeathInd;&lt;BR /&gt;set&amp;nbsp;HypTabs.NDI ( RENAME = ( DeathDt = DeathDt_Char )&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rest of code....&lt;/P&gt;</description>
    <pubDate>Tue, 07 Nov 2017 16:20:50 GMT</pubDate>
    <dc:creator>marianhabesland</dc:creator>
    <dc:date>2017-11-07T16:20:50Z</dc:date>
    <item>
      <title>Formats Not Recognized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411226#M3901</link>
      <description>&lt;P&gt;I have two formats that I want to use for the variables "COCd" and "HypRelDeathInd". The formats do not seem to be working. Does it have something to do with the order of the code or is there another problem? No error messages come up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data&amp;nbsp;HypTabs.NDI (label = "Death Data");&lt;BR /&gt;retain&amp;nbsp;SSN DeathDt ICD10 COCd HypRelDeathInd;&lt;BR /&gt;set&amp;nbsp;HypTabs.NDI (&amp;nbsp;rename = ( DeathDt = DeathDt_Char )&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;DeathDt = input(DeathDt_Char, YYMMDDD10.);&lt;BR /&gt;format&amp;nbsp;DeathDt YYMMDDD10.;&lt;BR /&gt;&lt;BR /&gt;drop&amp;nbsp;DeathDt_Char;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;COCd1= substr(ICD10, 1, 3);&lt;BR /&gt;if COCd1 = "I25"&amp;nbsp;then COCd = 1;&lt;BR /&gt;else&amp;nbsp;if COCd1 = "I50"&amp;nbsp;then COCd = 2;&lt;BR /&gt;else if&amp;nbsp;COCd1 = "I63"&amp;nbsp;then COCd = 3;&lt;BR /&gt;else&amp;nbsp;COCd = 4;&lt;BR /&gt;&lt;BR /&gt;if COCd= 1&amp;nbsp;then HypRelDeathInd = 1;&lt;BR /&gt;else&amp;nbsp;if COCd= 2&amp;nbsp;then HypRelDeathInd = 1;&lt;BR /&gt;else if&amp;nbsp;COCd= 3&amp;nbsp;then HypRelDeathInd = 1;&lt;BR /&gt;else if&amp;nbsp;COCd= 4&amp;nbsp;then HypRelDeathInd = 0;&lt;BR /&gt;&lt;BR /&gt;label&amp;nbsp;SSN = "Social Security Number"&lt;BR /&gt;DeathDt = "Death Date"&lt;BR /&gt;CODCd = "Cause of Death Code"&lt;BR /&gt;HypRelDeathInd = "Hypertension-Related Death";&lt;BR /&gt;drop&amp;nbsp;COCd1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;procformat&lt;BR /&gt;library&amp;nbsp;= HypTabs.HypFormats;&lt;/P&gt;&lt;P&gt;value&amp;nbsp;CODCd&lt;BR /&gt;. = 'Unknown'&lt;BR /&gt;1 = 'Heart Disease'&lt;BR /&gt;2 = 'Heart Failure'&lt;BR /&gt;3 = 'Stroke'&lt;BR /&gt;4 = 'Other COD'&lt;BR /&gt;OTHER = 'Unanticipated Value';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;value&amp;nbsp;HypRelDeathInd&lt;BR /&gt;. = 'Unknown'&lt;BR /&gt;0 = 'No'&lt;BR /&gt;1 = 'Yes'&lt;BR /&gt;OTHER = 'Unexpected Value';&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc&amp;nbsp;sort;&lt;BR /&gt;by&amp;nbsp;SSN;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 16:07:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411226#M3901</guid>
      <dc:creator>marianhabesland</dc:creator>
      <dc:date>2017-11-07T16:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Formats Not Recognized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411233#M3902</link>
      <description>&lt;P&gt;Yes, your formats have to be defined before the data step/where they're used. I personally like to recommend keeping all formats in a separate program all together and use %INCLUDE at the beginning of the program.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 16:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411233#M3902</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-07T16:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Formats Not Recognized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411237#M3903</link>
      <description>&lt;P&gt;Ok, that makes sense. However I tried doing it like this and it still did not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc format&lt;BR /&gt;library&amp;nbsp;= HypTabs.HypFormats;&lt;/P&gt;&lt;P&gt;value&amp;nbsp;CODCd&lt;BR /&gt;. = 'Unknown'&lt;BR /&gt;1 = 'Heart Disease'&lt;BR /&gt;2 = 'Heart Failure'&lt;BR /&gt;3 = 'Stroke'&lt;BR /&gt;4 = 'Other COD'&lt;BR /&gt;OTHER = 'Unanticipated Value';&lt;BR /&gt;&lt;BR /&gt;value&amp;nbsp;HypRelDeathInd&lt;BR /&gt;. = 'Unknown'&lt;BR /&gt;0 = 'No'&lt;BR /&gt;1 = 'Yes'&lt;BR /&gt;OTHER = 'Unexpected Value';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data&amp;nbsp;HypTabs.NDI (LABEL = "Death Data");&lt;BR /&gt;retain&amp;nbsp;SSN DeathDt ICD10 COCd HypRelDeathInd;&lt;BR /&gt;set&amp;nbsp;HypTabs.NDI ( RENAME = ( DeathDt = DeathDt_Char )&lt;BR /&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rest of code....&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 16:20:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411237#M3903</guid>
      <dc:creator>marianhabesland</dc:creator>
      <dc:date>2017-11-07T16:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: Formats Not Recognized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411243#M3904</link>
      <description>&lt;P&gt;You don't have a FORMAT statement applying the formats to the variables, or at least I didn't see one.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;There's a couple of other issues with your code and things you should do in general:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Format your code - indents/newlines&lt;/P&gt;
&lt;P&gt;2. Comment your code, so you understand it later&lt;/P&gt;
&lt;P&gt;3. You're mixing types. You cannot convert a character variable to a numeric variable, you need to create a new variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4. Always use a DATA= in your PROCS so you know explicitly what's being run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This still has bugs so it won't run, but I'll leave it to you to debug.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format
	library = HypTabs.HypFormats;
value CODCd
	. = 'Unknown'
	1 = 'Heart Disease'
	2 = 'Heart Failure'
	3 = 'Stroke'
	4 = 'Other COD'
	OTHER = 'Unanticipated Value';
value HypRelDeathInd
	. = 'Unknown'
	0 = 'No'
	1 = 'Yes'
	OTHER = 'Unexpected Value';
run;



data HypTabs.NDI (label = "Death Data");
	retain SSN DeathDt ICD10 COCd HypRelDeathInd;
	set HypTabs.NDI ( rename = ( DeathDt = DeathDt_Char )
		);
	DeathDt = input(DeathDt_Char, YYMMDDD10.);
	format DeathDt YYMMDDD10.;
	drop DeathDt_Char;
	COCd1= substr(ICD10, 1, 3);

	if COCd1 = "I25" then
		COCd = 1;
	else if COCd1 = "I50" then
		COCd = 2;
	else if COCd1 = "I63" then
		COCd = 3;
	else COCd = 4;

	if COCd= 1 then
		HypRelDeathInd = 1;
	else if COCd= 2 then
		HypRelDeathInd = 1;
	else if COCd= 3 then
		HypRelDeathInd = 1;
	else if COCd= 4 then
		HypRelDeathInd = 0;
	label SSN = "Social Security Number"
		DeathDt = "Death Date"
		CODCd = "Cause of Death Code"
		HypRelDeathInd = "Hypertension-Related Death";

	format HypRelDeathInd HypRelDeathInd. COCd CODCd.;
	drop COCd1;
run;

proc sort data=XXXXXXXXX;
	by SSN;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Nov 2017 16:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411243#M3904</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-07T16:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Formats Not Recognized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411246#M3905</link>
      <description>&lt;P&gt;Got it to work. Stupid spelling error..&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 16:34:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411246#M3905</guid>
      <dc:creator>marianhabesland</dc:creator>
      <dc:date>2017-11-07T16:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: Formats Not Recognized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411267#M3906</link>
      <description>&lt;P&gt;If you are saving your formats into a permanent library then make sure to set the FMTSEARCH option so that SAS can find them.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 17:27:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411267#M3906</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-11-07T17:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: Formats Not Recognized</title>
      <link>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411268#M3907</link>
      <description>&lt;P&gt;If the question is answered please mark it as solved. If you could also mark some of your previous questions that would be appreciated.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 17:28:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/Formats-Not-Recognized/m-p/411268#M3907</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-07T17:28:01Z</dc:date>
    </item>
  </channel>
</rss>

