<?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: creating a unintialised variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/creating-a-unintialised-variable/m-p/418090#M102691</link>
    <description>&lt;P&gt;Same old, same old.&amp;nbsp; These types of questions get asked daily.&amp;nbsp;&amp;nbsp;First off, why are you doing this in macro at all?&amp;nbsp; Macro does&amp;nbsp;&lt;STRONG&gt;not do anything&lt;/STRONG&gt; other some text replace function.&amp;nbsp; That mass of unwieldy code resolves to one simply datastep;&lt;/P&gt;
&lt;PRE&gt;data inc;
  set adam.adsl;
  array v{5} usubjid sex race age weightbl;
  do i=1 to 5;
    if vvname(v{i})="actarm" then do;
      ...;
    end;
    else do;
      ..;
    end;
  end;
run;&lt;/PRE&gt;
&lt;P&gt;As for why the text generated is UUSUBJID_USE, well look at:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;%let LstCols  = %quote(USUBJID SEX AGE RACE WEIGHTBL);&lt;/PRE&gt;
&lt;P&gt;And:&lt;/P&gt;
&lt;PRE&gt;%let LstCols_u=%sysfunc(tranwrd(&amp;amp;LstCols,SUBJID,USUBJID_USE));&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;So when you replace U&amp;lt;SUBJID&amp;gt; with USUBJID_USE, you get UUSUBJID_USE.&lt;/P&gt;</description>
    <pubDate>Mon, 04 Dec 2017 09:22:53 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-12-04T09:22:53Z</dc:date>
    <item>
      <title>creating a unintialised variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-unintialised-variable/m-p/418085#M102690</link>
      <description>&lt;P&gt;I am using the below code and somehow it creates UUSUBJID_USE which is not available and gets unintialised variable. Not sure from where it is creating. can any one help me to debug it.&lt;/P&gt;&lt;PRE&gt;   %macro inhc;
    %let LstCols  = %quote(USUBJID SEX AGE RACE WEIGHTBL);

  	%let totval=%eval(%sysfunc(countc(&amp;amp;LstCols,%str( )))+1);
    %let LstCols_u=%sysfunc(tranwrd(&amp;amp;LstCols,SUBJID,USUBJID_USE));
    %let LstCols_use=%sysfunc(tranwrd(&amp;amp;LstCols_u.,RACE,RACE_USE));

	data inc;
	  set adam.adsl;
	  %do i=1 %to &amp;amp;totval;
			%if %upcase(%scan(&amp;amp;LstCols_use,&amp;amp;i)) eq %upcase(actarm) %then %do;
				patinf=catx("/",patinf,actarm);
				if _n_=1 then patlbl=catx("/",patlbl,"treatment");
			%end;
			%else %do;
				patinf=catx("/",patinf,(%scan(&amp;amp;LstCols_use,&amp;amp;i)));
				if _n_=1 then patlbl=catx("/",patlbl,vlabel(%scan(&amp;amp;LstCols,&amp;amp;i)));
			%end;
		%end;
	run;

	%mend;
	%inhc;&lt;/PRE&gt;&lt;P&gt;attaching test data.&lt;/P&gt;&lt;P&gt;Log:&lt;/P&gt;&lt;P&gt;UUSUBJID_USE=. patlbl=. RACE_USE=. _ERROR_=1 _N_=19&lt;BR /&gt;NOTE: Over 100 NOTES, additional NOTES suppressed.&lt;BR /&gt;NOTE: Invalid numeric data, './.' , at line 3 column 25.&lt;BR /&gt;WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2017 08:40:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-unintialised-variable/m-p/418085#M102690</guid>
      <dc:creator>mj5</dc:creator>
      <dc:date>2017-12-04T08:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: creating a unintialised variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-unintialised-variable/m-p/418090#M102691</link>
      <description>&lt;P&gt;Same old, same old.&amp;nbsp; These types of questions get asked daily.&amp;nbsp;&amp;nbsp;First off, why are you doing this in macro at all?&amp;nbsp; Macro does&amp;nbsp;&lt;STRONG&gt;not do anything&lt;/STRONG&gt; other some text replace function.&amp;nbsp; That mass of unwieldy code resolves to one simply datastep;&lt;/P&gt;
&lt;PRE&gt;data inc;
  set adam.adsl;
  array v{5} usubjid sex race age weightbl;
  do i=1 to 5;
    if vvname(v{i})="actarm" then do;
      ...;
    end;
    else do;
      ..;
    end;
  end;
run;&lt;/PRE&gt;
&lt;P&gt;As for why the text generated is UUSUBJID_USE, well look at:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;%let LstCols  = %quote(USUBJID SEX AGE RACE WEIGHTBL);&lt;/PRE&gt;
&lt;P&gt;And:&lt;/P&gt;
&lt;PRE&gt;%let LstCols_u=%sysfunc(tranwrd(&amp;amp;LstCols,SUBJID,USUBJID_USE));&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;So when you replace U&amp;lt;SUBJID&amp;gt; with USUBJID_USE, you get UUSUBJID_USE.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2017 09:22:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-unintialised-variable/m-p/418090#M102691</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-12-04T09:22:53Z</dc:date>
    </item>
  </channel>
</rss>

