<?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: proc report compute macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456330#M115567</link>
    <description>&lt;P&gt;Why are you putting a list of variables into your macrovar, when you only need the name of one?&lt;/P&gt;</description>
    <pubDate>Sun, 22 Apr 2018 19:37:46 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-04-22T19:37:46Z</dc:date>
    <item>
      <title>proc report compute macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456325#M115564</link>
      <description>&lt;P&gt;How to compute macro variable in proc report, the &amp;amp;varlist. is displaying all column names as one. how to call only one column name.&lt;/P&gt;&lt;P&gt;proc sq;&lt;/P&gt;&lt;P&gt;select name into :varlist from the dictionary.columns where memname='test';&lt;/P&gt;&lt;P&gt;proc report data=qtrresults&lt;/P&gt;&lt;P&gt;column ID test1 test2&amp;nbsp; &amp;amp;varlist. ;&lt;/P&gt;&lt;P&gt;define ID / display "ID";&lt;/P&gt;&lt;P&gt;define test1 /display "test1";&lt;/P&gt;&lt;P&gt;define &amp;amp;varlist. /display;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute &amp;amp;varlist.;&lt;/P&gt;&lt;P&gt;if flag:_&amp;amp;varlist. =2 then&lt;/P&gt;&lt;P&gt;call define('dummy3',"style", "style=[font_style=italic background=yellow]");&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end comp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Apr 2018 19:26:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456325#M115564</guid>
      <dc:creator>radha009</dc:creator>
      <dc:date>2018-04-22T19:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: proc report compute macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456328#M115565</link>
      <description>&lt;P&gt;Fix the PROC SQL query so that there's a space between the items. There are many examples on here on how to do that, or the documentation has &lt;A href="http://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=n1y2jszlvs4hugn14nooftfrxhp3.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#n0siuil5847r0fn10mbzm8h238ox" target="_self"&gt;examples&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/192083"&gt;@radha009&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;How to compute macro variable in proc report, the &amp;amp;varlist. is displaying all column names as one. how to call only one column name.&lt;/P&gt;
&lt;P&gt;proc sq;&lt;/P&gt;
&lt;P&gt;select name into :varlist from the dictionary.columns where memname='test';&lt;/P&gt;
&lt;P&gt;proc report data=qtrresults&lt;/P&gt;
&lt;P&gt;column ID test1 test2&amp;nbsp; &amp;amp;varlist. ;&lt;/P&gt;
&lt;P&gt;define ID / display "ID";&lt;/P&gt;
&lt;P&gt;define test1 /display "test1";&lt;/P&gt;
&lt;P&gt;define &amp;amp;varlist. /display;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;compute &amp;amp;varlist.;&lt;/P&gt;
&lt;P&gt;if flag:_&amp;amp;varlist. =2 then&lt;/P&gt;
&lt;P&gt;call define('dummy3',"style", "style=[font_style=italic background=yellow]");&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;end comp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Apr 2018 19:34:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456328#M115565</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-22T19:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: proc report compute macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456329#M115566</link>
      <description>Its not clear if you're asking about the COLUMN or DEFINE statement. Note that a variables does not require a DEFINE statement, check what the default behaviour is first.</description>
      <pubDate>Sun, 22 Apr 2018 19:35:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456329#M115566</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-22T19:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: proc report compute macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456330#M115567</link>
      <description>&lt;P&gt;Why are you putting a list of variables into your macrovar, when you only need the name of one?&lt;/P&gt;</description>
      <pubDate>Sun, 22 Apr 2018 19:37:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456330#M115567</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-22T19:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: proc report compute macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456336#M115569</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/192083"&gt;@radha009&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;How to compute macro variable in proc report, the &amp;amp;varlist. is displaying all column names as one. how to call only one column name.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is really impossible to say given the little information you have provided us. "Is displaying all column names as one"??? makes no sense, since you don't tell us what is displaying ... show us what you mean, show us the SASLOG or other indication of the problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Further, you need to make sure your SAS syntax is correct.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no "proc sq;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The word "the" does not belong in "select name into :varlist from the dictionary.columns where memname='test';"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and so on&lt;/P&gt;</description>
      <pubDate>Sun, 22 Apr 2018 20:57:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456336#M115569</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-04-22T20:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: proc report compute macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456346#M115574</link>
      <description>&lt;P&gt;sorry for the typos and the wording.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I&amp;nbsp; want to create a report to show the cells colored if the data doesn't match.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my data few variables are dynamic,every month it will be different but they have a number start with chg so i am putting all columns which starts with %chg%.&lt;/P&gt;&lt;P&gt;------------------------&lt;/P&gt;&lt;P&gt;data comp.check5;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; merge descope.load2sp_ds (in=ina) comp.check4;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; by Name CI_ID;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if ina;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;select name into :varlist separated by ' '&lt;BR /&gt;from dictionary.columns&lt;BR /&gt;where&lt;BR /&gt;&amp;nbsp; libname = "COMP" and&lt;BR /&gt;&amp;nbsp; memname = "CHECK1" and&lt;BR /&gt;&amp;nbsp; name like '%CHG%';&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc report data=comp.check5 nowd;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; column Name ID test1 test2 flag_: Impacted_Flag Validation_required Validation_status&amp;nbsp; Validator_Name&amp;nbsp; flag_:&amp;amp;varlist. Maint_Window;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;define Name / display style(column)=[just=left cellwidth=3.1in]'Name';&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;define CI_ID / display style(column)=[just=left cellwidth=1.1in] 'ID';&lt;/P&gt;&lt;P&gt;&amp;nbsp; define flag_: / noprint display;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; define Impacted_Flag / display style(column)=[just=center cellwidth=1.1in] 'Impacted';&lt;/P&gt;&lt;P&gt;define var / computed display style(column)=[just=center cellwidth=1.1in];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute Impacted_Flag;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if FLAG_Impacted_flag = 2 then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call define(_col_, "style", "style=[background=yellow]");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;compute var;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i = 1 to dim(var) ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if FLAG_:&amp;amp;varlist. = 2 then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call define(_col_, "style", "style=[background=yellow]");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;endcomp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Apr 2018 23:55:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456346#M115574</guid>
      <dc:creator>radha009</dc:creator>
      <dc:date>2018-04-22T23:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: proc report compute macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456355#M115578</link>
      <description>&lt;P&gt;One thing you will have to do is loop over all the variable names in &amp;amp;varlist; this loop probably needs to be inside PROC REPORT.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can't use a list of variable names in PROC Report the way you are doing it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 01:29:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456355#M115578</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-04-23T01:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: proc report compute macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456357#M115579</link>
      <description>&lt;P&gt;Change your data structure and use a variable with an ACROSS instead. Then you don't need a lot of this...possibly any.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;sorry for the typos and the wording.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I&amp;nbsp; want to create a report to show the cells colored if the data doesn't match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;my data few variables are dynamic,every month it will be different but they have a number start with chg so i am putting all columns which starts with %chg%.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 23 Apr 2018 01:51:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-report-compute-macro-variable/m-p/456357#M115579</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-23T01:51:05Z</dc:date>
    </item>
  </channel>
</rss>

