<?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 What Am I Doing Wrong? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-Am-I-Doing-Wrong/m-p/895138#M353606</link>
    <description>&lt;P&gt;I have this statement written but when I run the code my format statement doesn't print. Any idea what I'm doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.HW6;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set TMP1.hw6;&lt;BR /&gt;proc format;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value $TestSite 'Thoracic'='T' 'Lumbar-Spine'='LS';&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value TypeOfImaging 1='MRI' 2='CT' 3='Plain';&lt;BR /&gt;proc sort data=work.HW6 nodupkey;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; by descending dos;&lt;BR /&gt;proc print data=work.HW6;&lt;BR /&gt;run;&lt;/P&gt;</description>
    <pubDate>Wed, 20 Sep 2023 21:03:28 GMT</pubDate>
    <dc:creator>madtex99</dc:creator>
    <dc:date>2023-09-20T21:03:28Z</dc:date>
    <item>
      <title>What Am I Doing Wrong?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-Am-I-Doing-Wrong/m-p/895138#M353606</link>
      <description>&lt;P&gt;I have this statement written but when I run the code my format statement doesn't print. Any idea what I'm doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.HW6;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; set TMP1.hw6;&lt;BR /&gt;proc format;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value $TestSite 'Thoracic'='T' 'Lumbar-Spine'='LS';&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; value TypeOfImaging 1='MRI' 2='CT' 3='Plain';&lt;BR /&gt;proc sort data=work.HW6 nodupkey;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; by descending dos;&lt;BR /&gt;proc print data=work.HW6;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 21:03:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-Am-I-Doing-Wrong/m-p/895138#M353606</guid>
      <dc:creator>madtex99</dc:creator>
      <dc:date>2023-09-20T21:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: What Am I Doing Wrong?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-Am-I-Doing-Wrong/m-p/895140#M353608</link>
      <description>&lt;P&gt;You would have to associate the Format with the variables that you want to use it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example: (Assumes that variables Thisvar and Thatvar are in the data set, Thisvar is a character variable and that you want those variables to show the formatted values.&lt;/P&gt;
&lt;PRE&gt;proc print data=work.HW6;
   FORMAT thisvar  $testsite. thatvar TypeofImaging. ;
run;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want a variable to use a format by default then you make the association permanent by assigning it in a data step or use the utility procedure Datasets to modify the set as such.&lt;/P&gt;
&lt;P&gt;The data step version would look like:&lt;/P&gt;
&lt;PRE&gt;data work.HW6;
        set TMP1.hw6;
       format thisvar $testsite. thatvar TypeofImaging. ;
run;&lt;/PRE&gt;
&lt;P&gt;The format does not actually have to exist in your session when assigned the variable but you should make sure it is available when you want to use it.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2023 21:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-Am-I-Doing-Wrong/m-p/895140#M353608</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-09-20T21:12:54Z</dc:date>
    </item>
  </channel>
</rss>

