<?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: Proc Format in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882691#M43665</link>
    <description>If you use the original variable with the format applied it will sort correctly. If you use the converted variable, a character variable, it sorts alphabetically.</description>
    <pubDate>Tue, 27 Jun 2023 20:03:58 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2023-06-27T20:03:58Z</dc:date>
    <item>
      <title>Proc Format</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882678#M43658</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to modify the formatting for variables in SAS 9.4 using 'proc format'. An example is the variable "sCYSleep" which ranges from 0-16. I am trying to create groups (as in the picture) with these values. When running frequency tables right after assigning formatting, I get the respective groups. However, whenever I run subsequent analysis, my sCYSleep variable takes on it's original 0-16.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way it can retain the formatted groupings? I'd like to have those in the dataset. I tried to manually change the values and SAS scrambles the order. Is there a way to also preserve the natural ordering of the variable names?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2023-06-27 at 2.49.40 PM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/85422i39BDC0E649C5BB49/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2023-06-27 at 2.49.40 PM.png" alt="Screenshot 2023-06-27 at 2.49.40 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 18:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882678#M43658</guid>
      <dc:creator>ValSki</dc:creator>
      <dc:date>2023-06-27T18:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882680#M43660</link>
      <description>&lt;P&gt;I think it would work if you apply the format in a data step instead of inside proc freq.&amp;nbsp; The format inside proc freq, I think, would only be held within that running of the procedure.&amp;nbsp; Doing it in a data step will apply the format "permanently" (i.e. in subsequent analytic steps, like proc freq).&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.val; set work.val; 
format sleepvar fmt.; 
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 19:07:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882680#M43660</guid>
      <dc:creator>awesome_opossum</dc:creator>
      <dc:date>2023-06-27T19:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882683#M43661</link>
      <description>&lt;P&gt;Hej,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4"&gt;&lt;SPAN&gt;Permanent Informats and Formats&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV class="xisDoc-refProc"&gt;
&lt;DIV class="xisDoc-concepts"&gt;
&lt;P class="xisDoc-paragraph"&gt;If you want to use a format or informat that is created in one SAS job or session in a subsequent job or session, then you must permanently store the format or informat in a SAS catalog.&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;You permanently store informats and formats by using the LIBRARY= option in the PROC FORMAT statement.&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;See the discussion of the LIBRARY= option in the PROC FORMAT Statement.&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;Also in doc :&lt;/P&gt;
&lt;H2 id="p19mfcfkne6nfln11bmju7wqkiif" class="xisDoc-title"&gt;&lt;FONT size="4"&gt;Accessing Permanent Informats and Formats&lt;/FONT&gt;&lt;/H2&gt;
&lt;H1 class="title"&gt;&lt;BR /&gt;&lt;FONT size="4"&gt;Concepts: FORMAT Procedure&lt;/FONT&gt;&lt;/H1&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p0owakbeh7u19cn0zrqftqldevpq.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#p0owakbeh7u19cn0zrqftqldevpq.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 27 Jun 2023 19:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882683#M43661</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2023-06-27T19:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882685#M43662</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Reeza_0-1687894454394.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/85423iB6F06031A0DFC364/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Reeza_0-1687894454394.png" alt="Reeza_0-1687894454394.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should work for you.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 19:34:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882685#M43662</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-06-27T19:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882688#M43663</link>
      <description>&lt;P&gt;Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for this solution!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know how to tell SAS to keep the categories in order (i.e., none, low, etc.). When I run frequency tables pr any subsequent stats, the categories are all jumbled up. It appears to be listed in alphabetical order (i.e., high, low, etc.).&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 19:59:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882688#M43663</guid>
      <dc:creator>ValSki</dc:creator>
      <dc:date>2023-06-27T19:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882689#M43664</link>
      <description>&lt;P&gt;"Natural ordering of the variable names"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does that mean?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you make a new variable it will naturally be added after all of the existing variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you convert a number to a character string it will naturally sort differently.&amp;nbsp; If you want the text values to sort in the same order as the original numeric values then you will need to be more creative in the strings you using.&amp;nbsp; Perhaps add a prefix to the strings?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 20:01:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882689#M43664</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-27T20:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882691#M43665</link>
      <description>If you use the original variable with the format applied it will sort correctly. If you use the converted variable, a character variable, it sorts alphabetically.</description>
      <pubDate>Tue, 27 Jun 2023 20:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882691#M43665</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-06-27T20:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882693#M43666</link>
      <description>Awesome, thank you!</description>
      <pubDate>Tue, 27 Jun 2023 20:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882693#M43666</guid>
      <dc:creator>ValSki</dc:creator>
      <dc:date>2023-06-27T20:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882696#M43668</link>
      <description>Hi Tom,&lt;BR /&gt;&lt;BR /&gt;I meant to preserve the hierarchical nature of the original variable names (i.e., none; low; moderate, etc.).&lt;BR /&gt;&lt;BR /&gt;I can preserve the ordering if I use the original variable name with the formatting applied. That seemed to have solve the problem of alphabetical ordering.</description>
      <pubDate>Tue, 27 Jun 2023 20:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882696#M43668</guid>
      <dc:creator>ValSki</dc:creator>
      <dc:date>2023-06-27T20:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882716#M43669</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267601"&gt;@ValSki&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi Tom,&lt;BR /&gt;&lt;BR /&gt;I meant to preserve the hierarchical nature of the original variable names (i.e., none; low; moderate, etc.).&lt;BR /&gt;&lt;BR /&gt;I can preserve the ordering if I use the original variable name with the formatting applied. That seemed to have solve the problem of alphabetical ordering.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So your did not mean variable names.&amp;nbsp; Your variable name is SCYSLEEP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are talking about VALUES not NAMES.&amp;nbsp; In particular the displayed values.&amp;nbsp; So either the formatted values of your existing numeric variable or the values stored into your new character variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 21:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/882716#M43669</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-27T21:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Format</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/883322#M43711</link>
      <description>&lt;P&gt;Reeze are you studying sleep probs again?&amp;nbsp;&amp;nbsp; You're going to make a helpful accident, which you do every time!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2023 13:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Proc-Format/m-p/883322#M43711</guid>
      <dc:creator>awesome_opossum</dc:creator>
      <dc:date>2023-07-03T13:17:08Z</dc:date>
    </item>
  </channel>
</rss>

