<?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: How do you label values in different format? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-do-you-label-values-in-different-format/m-p/404263#M66924</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;Thank you for that information. I really appreciate it. As a new user, and teaching myself, I am still very much trying to figure out how all of this works. Also, thank you for the heads up about the excel sheet thing. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 15 Oct 2017 03:23:11 GMT</pubDate>
    <dc:creator>savanahb</dc:creator>
    <dc:date>2017-10-15T03:23:11Z</dc:date>
    <item>
      <title>How do you label values in different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-you-label-values-in-different-format/m-p/404230#M66921</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I had this assignment last week for an intro to SAS class that I am taking involving and we are working with arrays. I&amp;nbsp;was supposed to present this data in a chart as described in the excel sheet I am attaching. I have managed to get everything to work except for labeling the agegroups (1-4) with different names (&amp;gt;30, 31-45, 46-60, 60+). It was suggested to continue using the else-if statements or to use proc format. Below is what I have, but it is just creating a new variable 'i'. Does anyone have any suggestions?&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HW4_F17; 
length Profession $ 9 Housingtype $ 11 tenure $ 5 Response $ 3;
array c condo1-condo4;
array t town1 - town4;
do profession = 'Physician','Professor','Engineer';
   do tenure ='Rent','Own','Lease';
      do response='Yes','No';
         input condo1-condo4 Town1-Town4;
         do agegroup=1 to 4;
            Housingtype='Condominium';
            Number = c[agegroup];
            output;
         end;
         do agegroup=1 to 4;
            Housingtype='Townhomes';
            Number = t[agegroup];
            output;
         end;
		 do agegroup=1 to 4;
		 	if i=1 then agegroup='&amp;gt;30';
			else if i=2 then agegroup='31-45';
			else if i=3 then agegroup='46-60';
			else if i=4 then agegroup='60+';
		end;
      end;
   end;
end;
drop condo: town:;		
datalines;
18 15 6 8 34 10 2 3
15 13 9 10 28 4 6 9
5 3 1 2 56 56 35 45
1 1 1 3 12 21 8 15
16 18 6 17 37 11 3 22
12 10 3 9 23 9 1 14
17 10 15 13 29 3 7 8
34 17 19 23 44 13 16 15
2 0 3 1 23 52 49 25
3 2 0 2 9 31 51 19
15 18 6 8 32 11 3 7
14 9 3 10 23 11 1 5
30 23 21 18 22 13 11 10
25 19 40 30 25 16 12 16
8 5 1 6 54 191 102 95
4 2 2 3 19 76 61 54
10 21 8 11 29 10 4 11
11 9 4 7 21 9 2 13
;	

proc print data=HW4_F17;
	title 'Tabulation of data from HW4_F17 data set';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Oct 2017 18:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-you-label-values-in-different-format/m-p/404230#M66921</guid>
      <dc:creator>savanahb</dc:creator>
      <dc:date>2017-10-14T18:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do you label values in different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-you-label-values-in-different-format/m-p/404239#M66922</link>
      <description>&lt;P&gt;Very few posters will risk opening a spreadsheet.&amp;nbsp; So mostly you will be getting "blind" answers to your questions, if any.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that creating a new variable is the whole idea of IF/THEN statements.&amp;nbsp; If that is the result you are obtaining, and if the values of the new variable are correct, your work is done.&amp;nbsp; I leave it up to you to determine whether you have obtained the proper values, but will note one piece that needs to be changed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your program defines AGEGROUP as a numeric variable, because this statement is the first one to mention AGEGROUP:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;do agegroup=1 to 4;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a result, you cannot assign character strings to AGEGROUP.&amp;nbsp; This statement would generate a note on the log:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if i=1 then agegroup='&amp;gt; 30' ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Always read the log.&amp;nbsp; You cannot afford to ignore such notes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are several other issues that appear suspicious, such as nesting the INPUT statement inside DO loops, and outputting before all the IF/THEN statements have been applied.&amp;nbsp; To get more help, you will probably need to spell out what the results should look like for your first line of data.&amp;nbsp; Nothing helps like knowing where you are heading.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Oct 2017 20:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-you-label-values-in-different-format/m-p/404239#M66922</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-10-14T20:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: How do you label values in different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-you-label-values-in-different-format/m-p/404241#M66923</link>
      <description>&lt;P&gt;I would tell the instructor that there is no need for any ARRAY statements to perform that task.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HW4_F17; 
length Profession Housingtype Tenure Response AgeGroup $20 Number 8;
do profession = 'Physician','Professor','Engineer';
  do tenure ='Rent','Own','Lease';
    do response='Yes','No';
      do Housingtype='Condominium','Townhomes';
        do agegroup='&amp;lt;=30','31-45','46-60','60+';
          input number @@ ;
          output;
        end;
      end;
    end;
  end;
end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Oct 2017 22:29:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-you-label-values-in-different-format/m-p/404241#M66923</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-10-14T22:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do you label values in different format?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-you-label-values-in-different-format/m-p/404263#M66924</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;Thank you for that information. I really appreciate it. As a new user, and teaching myself, I am still very much trying to figure out how all of this works. Also, thank you for the heads up about the excel sheet thing. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Oct 2017 03:23:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-you-label-values-in-different-format/m-p/404263#M66924</guid>
      <dc:creator>savanahb</dc:creator>
      <dc:date>2017-10-15T03:23:11Z</dc:date>
    </item>
  </channel>
</rss>

