<?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 to specify in SAS to print only that variable which fulfills condition of 'if then' statemen in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-in-SAS-to-print-only-that-variable-which-fulfills/m-p/673321#M202537</link>
    <description>&lt;P&gt;To have such a customised output, I would print directly from the data step.&lt;/P&gt;
&lt;P&gt;Two solutions:&lt;/P&gt;
&lt;P&gt;- The easy and less flexible one, using&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=odsug&amp;amp;docsetTarget=p0kvsf7kg1hdnrn18ro656u42l3o.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;ODS Output in the Data Step&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;- The more complex and more flexible one, using the &lt;A href="https://www.lexjansen.com/pnwsug/2007/Richard%20Koopmann%20-%20Experimenting%20with%20the%20ODS%20DATA%20Step%20Object.pdf" target="_self"&gt;ODS Data Step Object&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jul 2020 22:30:24 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2020-07-29T22:30:24Z</dc:date>
    <item>
      <title>How to specify in SAS to print only that variable which fulfills condition of 'if then' statement?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-in-SAS-to-print-only-that-variable-which-fulfills/m-p/673254#M202494</link>
      <description />
      <pubDate>Thu, 03 Sep 2020 21:52:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-specify-in-SAS-to-print-only-that-variable-which-fulfills/m-p/673254#M202494</guid>
      <dc:creator>nirsan</dc:creator>
      <dc:date>2020-09-03T21:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify in SAS to print only that variable which fulfills condition of 'if then' statemen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-in-SAS-to-print-only-that-variable-which-fulfills/m-p/673271#M202503</link>
      <description>&lt;P&gt;Were I to try something like this, I would switch from Proc Print to Proc Report.&amp;nbsp; Proc Report has COMPUTE blocks that could allow you to blank out certain variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 19:08:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-specify-in-SAS-to-print-only-that-variable-which-fulfills/m-p/673271#M202503</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-07-29T19:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify in SAS to print only that variable which fulfills condition of 'if then' statemen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-in-SAS-to-print-only-that-variable-which-fulfills/m-p/673321#M202537</link>
      <description>&lt;P&gt;To have such a customised output, I would print directly from the data step.&lt;/P&gt;
&lt;P&gt;Two solutions:&lt;/P&gt;
&lt;P&gt;- The easy and less flexible one, using&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=odsug&amp;amp;docsetTarget=p0kvsf7kg1hdnrn18ro656u42l3o.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;ODS Output in the Data Step&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;- The more complex and more flexible one, using the &lt;A href="https://www.lexjansen.com/pnwsug/2007/Richard%20Koopmann%20-%20Experimenting%20with%20the%20ODS%20DATA%20Step%20Object.pdf" target="_self"&gt;ODS Data Step Object&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 22:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-specify-in-SAS-to-print-only-that-variable-which-fulfills/m-p/673321#M202537</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-07-29T22:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to specify in SAS to print only that variable which fulfills condition of 'if then' statemen</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-specify-in-SAS-to-print-only-that-variable-which-fulfills/m-p/673368#M202562</link>
      <description>&lt;P&gt;First, transpose into a long dataset, and then use SQL to extract all combinations of your wanted values. To achieve the final display, you will have to use a DATA step again (see the log for a possible example output):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines dlm=',' dsd truncover;
input ID Hlth_1 Hlth_2 Hlth_3 imun_1 imun_2;
datalines;
1,999,444,666,999,198
2,777,666,666,222
3,999,777,999
4,333,222,222,222
5,555,222
6,888,999,,111,999
7,444,333,,444
;

proc transpose data=have out=long;
by id;
var hlth: imun:;
run;

proc sql;
create table want as
  select
    h.id,
    h._name_ as n_hlth,
    h.col1 as hlth,
    i._name_ as n_imun,
    i.col1 as imun
  from long h, long i
  where
    h.id = i.id and
    upcase(h._name_) like 'HLTH%' and
    h.col1 = 999 and
    upcase(i._name_) like 'IMUN%' and
    i.col1 = 999
;
quit;

data _null_;
set want;
put @1 id @10 n_hlth @20 n_imun;
put @10 hlth @20 imun;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jul 2020 08:27:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-specify-in-SAS-to-print-only-that-variable-which-fulfills/m-p/673368#M202562</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-07-30T08:27:46Z</dc:date>
    </item>
  </channel>
</rss>

