<?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: Hot to get required output. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/574150#M162175</link>
    <description>Thanks !</description>
    <pubDate>Wed, 17 Jul 2019 12:44:49 GMT</pubDate>
    <dc:creator>gamotte</dc:creator>
    <dc:date>2019-07-17T12:44:49Z</dc:date>
    <item>
      <title>Hot to get required output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573747#M162031</link>
      <description>&lt;P&gt;how to get the required output from the condition if check1-check24 = '1' then TERM=(frac1_ to frac24_). Using macro.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Check1_&lt;/TD&gt;&lt;TD&gt;Check2_&lt;/TD&gt;&lt;TD&gt;Check3_&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;T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 04:37:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573747#M162031</guid>
      <dc:creator>Aayushi_17</dc:creator>
      <dc:date>2019-07-16T04:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Hot to get required output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573748#M162032</link>
      <description>&lt;P&gt;I don't understand this. So if all your check variables are equal to '1', then what?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 05:13:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573748#M162032</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-07-16T05:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Hot to get required output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573749#M162033</link>
      <description>Then I have get the required output for term..it's s condition like if&lt;BR /&gt;check1="1" then term=frac1_;&lt;BR /&gt;</description>
      <pubDate>Tue, 16 Jul 2019 05:17:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573749#M162033</guid>
      <dc:creator>Aayushi_17</dc:creator>
      <dc:date>2019-07-16T05:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Hot to get required output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573754#M162036</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/245051"&gt;@Aayushi_17&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Then I have get the required output for term..it's s condition like if&lt;BR /&gt;check1="1" then term=frac1_;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Sorry, i don't understand what you have and what you want. From the tables you have posted, the result seems to be a list of the non-null values of you frac-table, there seems to be no need to use the check-table at all. So ignoring "check", you should: use a data-step to transpose "frac" so that you have a table of frac-number and the value (skip missing values). then sort by frac-number -&amp;gt; job done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: If you want code, you have to post data in usable form: a data step using datalines statement.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 06:17:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573754#M162036</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-07-16T06:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Hot to get required output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573766#M162039</link>
      <description>&lt;P&gt;No macro needed. You want to stack the columns, and to do that dynamically, use sashelp.vcolumn as a source:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines dlm=',' dsd truncover;
input (frac1_ frac2_ frac3_) ($);
datalines;
Extreme,,Good
Good,Extreme,Good
Average,Not Good,Good
Not Good,,Good
Neat,Neat
Vba,Neat
Average
;

data _null_;
set sashelp.vcolumn (
  where=(libname = 'WORK' and memname = 'HAVE')
) end=eof;
if _n_ = 1 then call execute('data want (keep=term where=(term ne " ")); set');
call execute('
  have (rename=(' !! strip(name) !! '=term))
');
if eof then call execute('; run;');
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;term

Extreme 
Good    
Average 
Not Good
Neat    
Vba     
Average 
Extreme 
Not Good
Neat    
Neat    
Good    
Good    
Good    
Good    
&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jul 2019 08:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573766#M162039</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-16T08:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Hot to get required output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573806#M162052</link>
      <description>&lt;P&gt;Do you have IML ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines dlm=',' dsd truncover;
input (frac1_ frac2_ frac3_) ($);
datalines;
Extreme,,Good
Good,Extreme,Good
Average,Not Good,Good
Not Good,,Good
Neat,Neat
Vba,Neat
Average
;

data temp;
 set have;
 array x{*} $ frac: ;
 do i=1 to dim(x);
   if not missing(x{i}) then do;name=x{i};output;end;
 end;
 keep i name;
run;
proc sort data=temp out=want;
 by i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jul 2019 11:49:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573806#M162052</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-07-16T11:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Hot to get required output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573818#M162060</link>
      <description>Can we be assured that the initial order will be preserved for a given value of i ? Is that a documented feature ?</description>
      <pubDate>Tue, 16 Jul 2019 12:35:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/573818#M162060</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-07-16T12:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Hot to get required output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/574125#M162165</link>
      <description>&lt;P&gt;Sorry. I don't understand you .&lt;/P&gt;
&lt;P&gt;But as from OP' data, These two tables is perfectly matched ,&lt;/P&gt;
&lt;P&gt;therefore I assume "&lt;SPAN&gt;&amp;nbsp;be assured that the initial order will be preserved".&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 11:06:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/574125#M162165</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-07-17T11:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Hot to get required output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/574145#M162171</link>
      <description>&lt;P&gt;Sorry for not being clear. English is not my first language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I meant that you do not have to do something like :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
    set have;
    array x{*} $ frac: ;

    n=_N_; /* we keep track of the initial order */

    do i=1 to dim(x);
        if not missing(x{i}) then do;name=x{i};output;end;
    end;
    keep i n name;
run;

proc sort data=temp out=want;
    by i n;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;to ensure that for i=1, the order of values is the same as in column frac1_ of the initial dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is, the default sort algorithm for proc sort ensures that observations with the same value for the&lt;/P&gt;
&lt;P&gt;sort criterion wil appear in the same order than before the sort.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 12:34:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/574145#M162171</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-07-17T12:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: Hot to get required output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/574148#M162174</link>
      <description>&lt;P&gt;Ha. That is what PROC SORT will consider (keep original order).&lt;/P&gt;
&lt;P&gt;That is a big thing I love SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Unless you used option "noequals" .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sort data=have noequals;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jul 2019 12:42:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/574148#M162174</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-07-17T12:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Hot to get required output.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/574150#M162175</link>
      <description>Thanks !</description>
      <pubDate>Wed, 17 Jul 2019 12:44:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hot-to-get-required-output/m-p/574150#M162175</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-07-17T12:44:49Z</dc:date>
    </item>
  </channel>
</rss>

