<?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: sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Assign-categories/m-p/655301#M196627</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&amp;nbsp;Easily the most unhelpful title one could find. It think it will be hard to top! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Changed to: &lt;EM&gt;Assign categories&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jun 2020 08:52:24 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2020-06-09T08:52:24Z</dc:date>
    <item>
      <title>Assign categories</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-categories/m-p/654935#M196610</link>
      <description>&lt;P&gt;Hi team,&lt;/P&gt;
&lt;P&gt;data demo;&lt;/P&gt;
&lt;P&gt;input subid$ a1-a5;&lt;/P&gt;
&lt;P&gt;cards;&lt;/P&gt;
&lt;P&gt;101 2 1 2 1 0&lt;/P&gt;
&lt;P&gt;102 3 1 2 0 1&lt;/P&gt;
&lt;P&gt;103 4 2 0 2 3&lt;/P&gt;
&lt;P&gt;104 5 0 2 0 2&lt;/P&gt;
&lt;P&gt;105 0 1 1 1 4&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;0=missing 1=mild 2=modarate 3=severe 4=life threting 5 =death&lt;/P&gt;
&lt;P&gt;use a1-a5 variable and create same vars ac1-ac-5 replace the above formate value&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 08:53:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-categories/m-p/654935#M196610</guid>
      <dc:creator>nayab_shaik</dc:creator>
      <dc:date>2020-06-09T08:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-categories/m-p/654944#M196611</link>
      <description>&lt;P&gt;&lt;STRONG&gt;PLEASE USE A DESCRIPTIVE SUBJECT LINE!&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;(using just "sas" in the &lt;STRONG&gt;SAS&lt;/STRONG&gt; Communities is not an indicator of sufficient intelligence needed to work with SAS)&lt;/P&gt;
&lt;P&gt;And show us an example of the expected outcome; right now, your question is very hard to understand.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 06:07:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-categories/m-p/654944#M196611</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-09T06:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-categories/m-p/654996#M196613</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/275954"&gt;@nayab_shaik&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of using an IF/THEN/ELSE approach to assign each value, I suggest that you define a format using a PROC FORMAT, which is easier to maintain. Then you can use a PUT() function to convert the numeric value to a character one using this format.&lt;/P&gt;
&lt;P&gt;Arrays allow you not to repeat the same data manipulation for each variable.&lt;/P&gt;
&lt;P&gt;NB: the array referencing the new variables (_ac, which contains ac1 to ac5) is defined as character ($). Don't forget to assign the proper length to avoid truncation (here, I have put 20).&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
input subid$ a1-a5;
cards;
101 2 1 2 1 0
102 3 1 2 0 1
103 4 2 0 2 3
104 5 0 2 0 2
105 0 1 1 1 4
;
run;

proc format;
	value fa 0="missing"
			 1="mild"
			 2="moderate" 
			 3="severe" 
			 4="life threatening" 
			 5 ="death";
run;

data want;
	set demo;
	array _a (*) a1-a5;
	array _ac (*) $20 ac1-ac5;
	do i=1 to dim(_a);
		_ac(i) = put(_a(i), fa.);
	end;
	drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Jun 2020 06:50:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-categories/m-p/654996#M196613</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-09T06:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-categories/m-p/655301#M196627</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;&amp;nbsp;Easily the most unhelpful title one could find. It think it will be hard to top! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Changed to: &lt;EM&gt;Assign categories&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 08:52:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-categories/m-p/655301#M196627</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-06-09T08:52:24Z</dc:date>
    </item>
  </channel>
</rss>

