<?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: macros in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/603424#M16946</link>
    <description>&lt;P&gt;There are numerous reasons why your macro won't work. E.g., In the macro you try to use two macro variables (&amp;amp;lwork and &amp;amp;sex) that weren't declared. Also, within the macro, you try to assign values directly to at least one of the macro variables by just using an =.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are probably other reasons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Nov 2019 03:51:36 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2019-11-12T03:51:36Z</dc:date>
    <item>
      <title>macros</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/603417#M16945</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;Hi SAS user, &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;can anyone tell me why my macros codes is not working?&lt;/STRONG&gt;&lt;/FONT&gt;&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;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; counts(code=,code_count=, age_code=, date_code=,label1=, label2=);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;proc sort data=&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;lwork.&lt;STRONG&gt;.c&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;rohns_count1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;by &amp;amp;id &amp;amp;claim_dt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data &amp;amp;code (keep = &amp;amp;id &amp;amp;code_count &amp;amp;age_code &amp;amp;sex);&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;set &amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;lwork.&lt;STRONG&gt;.c&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;rohns_count1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;by &amp;amp;id &amp;amp;claim_dt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;where &amp;amp;code=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;if &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;first.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;amp;id then do;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;amp;code_count=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;amp;code_count+&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;amp;age_code=(&amp;amp;claim_dt-&amp;amp;dob)/&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;365.25&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;amp;date_code=&amp;amp;claim_dt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*keeps crohn's disease dx only--doesn't count uc9 dx;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;if &lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;last.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;&amp;amp;id then output;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;label &amp;amp;code_count=&amp;amp;label1;&lt;/P&gt;&lt;P&gt;label &amp;amp;date_code=&amp;amp;label2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc freq data=&amp;amp;code;&lt;/P&gt;&lt;P&gt;table &amp;amp;code_count;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;/*generally people have more than 1 encounter*/&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="2"&gt;/*** is from counts macro ***/&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;counts&lt;/I&gt;&lt;/STRONG&gt;(code=cd9 , code_count=cd9_count , age_code=cd9_age_first , date_code=cd9_date_first ,&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;(label1=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'CD Code for ICD-9'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; , label2=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Number of Crohns encounters in ICD-9'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;,label3=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Age of first CD diagnosis in ICD-9'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; , Label4=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Date of first CD diagnosis in ICD-9'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; );&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;counts&lt;/I&gt;&lt;/STRONG&gt;(code=uc9 , code_count=uc9_count , age_code=uc9_age_first , date_code=uc9_date_first ,&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;(label1=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'UC Code for ICD-9'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;, label2=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Number of UC encounters in ICD-9'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;, label3=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Age of first UC diagnosis in ICD-9'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; , label4=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Date of first UC diagnosis in ICD-9'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;counts&lt;/I&gt;&lt;/STRONG&gt;(code=cd10, code_count=cd10_count, age_code=cd10_age_first, date_code=cd10_date_first ,&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;(label1=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'CD Code for ICD-10'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; , label2=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Number of CD encounters in ICD-10'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; , label3=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Age of first CD diagnosis in ICD-10'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; , label4=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Date of first CD diagnosis in ICD-10'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;counts&lt;/I&gt;&lt;/STRONG&gt;(code=uc10, code_count=uc10_count, age_code=uc10_age_first, date_code=uc10_date_first ,&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;(label1=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'UC Code for ICD-10'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;, label2=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Number of UC encounters in ICD-10'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; , label3=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Age of first UC diagnosis in ICD-10'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;, label4=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'Date of first UC diagnosis in ICD-10'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&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>Tue, 12 Nov 2019 02:17:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macros/m-p/603417#M16945</guid>
      <dc:creator>nturne</dc:creator>
      <dc:date>2019-11-12T02:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/603424#M16946</link>
      <description>&lt;P&gt;There are numerous reasons why your macro won't work. E.g., In the macro you try to use two macro variables (&amp;amp;lwork and &amp;amp;sex) that weren't declared. Also, within the macro, you try to assign values directly to at least one of the macro variables by just using an =.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are probably other reasons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2019 03:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macros/m-p/603424#M16946</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2019-11-12T03:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: macros</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macros/m-p/603430#M16950</link>
      <description>&lt;P&gt;Your macro allows these inputs:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro counts
(code=
,code_count=
,age_code=
,date_code=
,label1=
,label2=
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the call you provide values for the first 4 parameters, but then you try to pass a positional value after the named parameters. Your macro does not accept any positional parameter, and if it did you would need to supply them BEFORE any parameters you pass by name.&lt;/P&gt;
&lt;P&gt;You are also missing the closing right parenthesis to end the macro call since the one you have will be used to close the left parenthesis that you have at the start of the last parameter.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%counts
(code=cd9 
,code_count=cd9_count 
,age_code=cd9_age_first 
,date_code=cd9_date_first 
, (label1='CD Code for ICD-9' , label2='Number of Crohns encounters in ICD-9',label3='Age of first CD diagnosis in ICD-9' , Label4='Date of first CD diagnosis in ICD-9' );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Nov 2019 04:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macros/m-p/603430#M16950</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-11-12T04:55:57Z</dc:date>
    </item>
  </channel>
</rss>

