<?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 Data Manage in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-Manage/m-p/398161#M96266</link>
    <description>&lt;P&gt;Dear Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Got the following situation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Have;&lt;/P&gt;&lt;P&gt;input D1-D10 $;&lt;/P&gt;&lt;P&gt;Cards;&lt;/P&gt;&lt;P&gt;80&amp;nbsp;&amp;nbsp;&amp;nbsp; 81&amp;nbsp;&amp;nbsp; 32&amp;nbsp;&amp;nbsp;&amp;nbsp; 45&amp;nbsp;&amp;nbsp; 22&lt;/P&gt;&lt;P&gt;75&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp; 65&amp;nbsp;&amp;nbsp; 82&amp;nbsp;&amp;nbsp; 45&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&amp;nbsp;&amp;nbsp;&amp;nbsp; 82&lt;/P&gt;&lt;P&gt;15&amp;nbsp;&amp;nbsp; 80&amp;nbsp;&amp;nbsp;&amp;nbsp; 32&amp;nbsp;&amp;nbsp;&amp;nbsp; 21&amp;nbsp;&amp;nbsp; 45&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;50&amp;nbsp;&amp;nbsp; 32&amp;nbsp;&amp;nbsp; 19&amp;nbsp;&amp;nbsp; 23&amp;nbsp; 75&lt;/P&gt;&lt;P&gt;83&amp;nbsp;&amp;nbsp; 22&amp;nbsp;&amp;nbsp;&amp;nbsp; 19&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;32&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;&lt;P&gt;12&amp;nbsp;&amp;nbsp; 75&amp;nbsp;&amp;nbsp;&amp;nbsp; 34;&lt;/P&gt;&lt;P&gt;.... (about 30,000 rows)&lt;/P&gt;&lt;P&gt;I would like to convert the above data&amp;nbsp;as -&amp;nbsp;anywhere if&amp;nbsp;there is 80 or 81 or 83 then it is&amp;nbsp;h1, similarly where ever there is 23, 32, or 34 then it is f4 etc. At the end it would all be one letter and one number like:&lt;/P&gt;&lt;P&gt;h1&amp;nbsp; &amp;nbsp;h1&amp;nbsp; &amp;nbsp;f4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c2&amp;nbsp;&amp;nbsp;&amp;nbsp; f1&lt;/P&gt;&lt;P&gt;b2&amp;nbsp;&amp;nbsp; a1&amp;nbsp;&amp;nbsp; a1&amp;nbsp;&amp;nbsp;&amp;nbsp; c5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;h1&amp;nbsp;&amp;nbsp;c2&amp;nbsp;&amp;nbsp; f2&amp;nbsp; h1&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried like:&lt;/P&gt;&lt;P&gt;if D1 in ('80', '81', '83') then D1='h1'.&lt;/P&gt;&lt;P&gt;Since D2 or D3 or D4 etc. will also have a value either 80 or 81 or 83 then typing&amp;nbsp;for D2 (and D3 and D4&amp;nbsp;etc.) like&amp;nbsp;'if D2 in ('80', '81, '83'&amp;nbsp;) then D2='h1' and son on and so forth is very cumbersome.&lt;/P&gt;&lt;P&gt;I am sure there are experts in the community who have better ideas to help me out&amp;nbsp; by eliminating 'if ... then' statementes for each variables and all&amp;nbsp;its values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Sijansap&lt;/P&gt;</description>
    <pubDate>Fri, 22 Sep 2017 16:10:52 GMT</pubDate>
    <dc:creator>sijansap</dc:creator>
    <dc:date>2017-09-22T16:10:52Z</dc:date>
    <item>
      <title>Data Manage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Manage/m-p/398161#M96266</link>
      <description>&lt;P&gt;Dear Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Got the following situation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Have;&lt;/P&gt;&lt;P&gt;input D1-D10 $;&lt;/P&gt;&lt;P&gt;Cards;&lt;/P&gt;&lt;P&gt;80&amp;nbsp;&amp;nbsp;&amp;nbsp; 81&amp;nbsp;&amp;nbsp; 32&amp;nbsp;&amp;nbsp;&amp;nbsp; 45&amp;nbsp;&amp;nbsp; 22&lt;/P&gt;&lt;P&gt;75&amp;nbsp;&amp;nbsp; 10&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&amp;nbsp;&amp;nbsp;&amp;nbsp; 65&amp;nbsp;&amp;nbsp; 82&amp;nbsp;&amp;nbsp; 45&amp;nbsp;&amp;nbsp;&amp;nbsp; 20&amp;nbsp;&amp;nbsp;&amp;nbsp; 82&lt;/P&gt;&lt;P&gt;15&amp;nbsp;&amp;nbsp; 80&amp;nbsp;&amp;nbsp;&amp;nbsp; 32&amp;nbsp;&amp;nbsp;&amp;nbsp; 21&amp;nbsp;&amp;nbsp; 45&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;50&amp;nbsp;&amp;nbsp; 32&amp;nbsp;&amp;nbsp; 19&amp;nbsp;&amp;nbsp; 23&amp;nbsp; 75&lt;/P&gt;&lt;P&gt;83&amp;nbsp;&amp;nbsp; 22&amp;nbsp;&amp;nbsp;&amp;nbsp; 19&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&amp;nbsp;&amp;nbsp;&amp;nbsp;32&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;/P&gt;&lt;P&gt;12&amp;nbsp;&amp;nbsp; 75&amp;nbsp;&amp;nbsp;&amp;nbsp; 34;&lt;/P&gt;&lt;P&gt;.... (about 30,000 rows)&lt;/P&gt;&lt;P&gt;I would like to convert the above data&amp;nbsp;as -&amp;nbsp;anywhere if&amp;nbsp;there is 80 or 81 or 83 then it is&amp;nbsp;h1, similarly where ever there is 23, 32, or 34 then it is f4 etc. At the end it would all be one letter and one number like:&lt;/P&gt;&lt;P&gt;h1&amp;nbsp; &amp;nbsp;h1&amp;nbsp; &amp;nbsp;f4&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c2&amp;nbsp;&amp;nbsp;&amp;nbsp; f1&lt;/P&gt;&lt;P&gt;b2&amp;nbsp;&amp;nbsp; a1&amp;nbsp;&amp;nbsp; a1&amp;nbsp;&amp;nbsp;&amp;nbsp; c5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;h1&amp;nbsp;&amp;nbsp;c2&amp;nbsp;&amp;nbsp; f2&amp;nbsp; h1&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried like:&lt;/P&gt;&lt;P&gt;if D1 in ('80', '81', '83') then D1='h1'.&lt;/P&gt;&lt;P&gt;Since D2 or D3 or D4 etc. will also have a value either 80 or 81 or 83 then typing&amp;nbsp;for D2 (and D3 and D4&amp;nbsp;etc.) like&amp;nbsp;'if D2 in ('80', '81, '83'&amp;nbsp;) then D2='h1' and son on and so forth is very cumbersome.&lt;/P&gt;&lt;P&gt;I am sure there are experts in the community who have better ideas to help me out&amp;nbsp; by eliminating 'if ... then' statementes for each variables and all&amp;nbsp;its values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Sijansap&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 16:10:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Manage/m-p/398161#M96266</guid>
      <dc:creator>sijansap</dc:creator>
      <dc:date>2017-09-22T16:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Data Manage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Manage/m-p/398177#M96269</link>
      <description>&lt;P&gt;A typical solution for displaying a value based on another is to use a format.&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
value $mycode
'80','81','83' = 'h1'
'23','32','34' = 'f4'
;

Data Have;
   infile datalines missover;
   informat D1-D10 $5.; 
   input D1-D10 ;
format d1-d10 $mycode.;
Cards;
80    81   32    45   22   
75   10    12    65   82   45    20    82  
15   80    32    21   45    50   32   19   23  75
83   22    19    25   32    10   
12   75    34  
;
run;&lt;/PRE&gt;
&lt;P&gt;You didn't really provide a rule for other values but I think this example is clear.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An advantage of this approach is that you can display the original value at any time incase you need to check the assignments just by changing the format to something like $2 in the table viewer or proc print.&lt;/P&gt;
&lt;P&gt;Another advantage is that if you later need different groupings you can create an additional format an use that for a specific report or analysis without changing values or adding variables.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 16:53:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Manage/m-p/398177#M96269</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-22T16:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: Data Manage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-Manage/m-p/398187#M96275</link>
      <description>Dear BallardW,&lt;BR /&gt;Thank you so much for your help. This format statement is much faster and easier for me to convert the data I have. I appreciate very much for your kindness and help.&lt;BR /&gt;Sijansap</description>
      <pubDate>Fri, 22 Sep 2017 17:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-Manage/m-p/398187#M96275</guid>
      <dc:creator>sijansap</dc:creator>
      <dc:date>2017-09-22T17:14:22Z</dc:date>
    </item>
  </channel>
</rss>

