<?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 generate this string in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524940#M4871</link>
    <description>&lt;P&gt;Thank you very much. It works!&lt;/P&gt;&lt;P&gt;The string contains field names form a dateset which is updated monthly with a new&amp;nbsp; field name added to it.&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
    <pubDate>Sun, 06 Jan 2019 23:07:23 GMT</pubDate>
    <dc:creator>JP1234</dc:creator>
    <dc:date>2019-01-06T23:07:23Z</dc:date>
    <item>
      <title>how to generate this string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524761#M4819</link>
      <description>&lt;P&gt;start='01feb2017'd;&lt;/P&gt;&lt;P&gt;end='05may2018'd;&lt;/P&gt;&lt;P&gt;I want to generate a string&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IND_FEB17,IND_MAR17, IND_APR17, IND_MAY17,.....IND_ARP18, IND_MAY18&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to use a marcro to do that?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jan 2019 23:32:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524761#M4819</guid>
      <dc:creator>JP1234</dc:creator>
      <dc:date>2019-01-04T23:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate this string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524763#M4821</link>
      <description>&lt;P&gt;Very simple with datastep syntax than macro syntax IMHO&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data w;
do i=0 to intck('month','01feb2017'd,'05may2018'd);
list=catx('_','IND',put(intnx('month','01feb2017'd,i),monyy.));
output;
end;
drop i;
run;

proc sql;
select list into :list separated by ','
from w;
quit;
%put &amp;amp;=list;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Jan 2019 00:12:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524763#M4821</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-05T00:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate this string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524764#M4822</link>
      <description>&lt;P&gt;You can macrotise the above with a macro wrapper like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
dm log 'clear';
%macro t(start='01feb2017'd,end='05may2018'd);
%global list;
data w;
do i=0 to intck('month',&amp;amp;start,&amp;amp;end);
list=catx('_','IND',put(intnx('month',&amp;amp;start,i),monyy.));
output;
end;
drop i;
run;
proc sql noprint;
select list into :list separated by ','
from w;
quit;
%mend t;
%t
%put list=&amp;amp;list;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Jan 2019 00:08:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524764#M4822</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-01-05T00:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate this string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524768#M4824</link>
      <description>&lt;P&gt;It may help to tell us how you intend to use the resulting string.&lt;/P&gt;
&lt;P&gt;If it is supposed to represent a list of data sets or variables you may be able to us list notation such as&lt;/P&gt;
&lt;P&gt;IND_:&amp;nbsp;&amp;nbsp; all variables or datasets that start with ind_&lt;/P&gt;
&lt;P&gt;Ind_feb17 - ind_may18&amp;nbsp; possibly, depends on actual values of other dataset names or variables as month names or abbreviations are a not well thought out value for sorting/selection in order&lt;/P&gt;
&lt;P&gt;ind_feb17 -- ind_may18 (adjacent variables in a set)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 00:23:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524768#M4824</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-05T00:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate this string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524787#M4831</link>
      <description>&lt;P&gt;I agree with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;that you might get more benefit from the forum if you let us know why you need this list.&amp;nbsp; There may be many shortcuts that don't require itemizing the elements of the list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, this can be done fairly directly in a macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro monyy_list(prefix=,start=,end=);
  %global strng;
  %do d=%sysfunc(inputn(&amp;amp;start,date9.)) %to %sysfunc(inputn(&amp;amp;end,date9.));
    %let strng=&amp;amp;strng &amp;amp;prefix%sysfunc(putn(&amp;amp;d,monyy5.));
    %let d=%sysfunc(intnx(month,&amp;amp;d,1));
  %end;
%mend monyy_list;

%monyy_list(prefix=IND_,start=01feb2017,end=05may2018);
%put &amp;amp;=strng;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The %sysfunc macro function is a way to invoke regular SAS functions in the macro environment.&amp;nbsp; In this case,&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The INPUTN function reads a value as if into a numeric variable.&lt;/LI&gt;
&lt;LI&gt;The PUTN function write a number as text according to the specific format.&lt;/LI&gt;
&lt;LI&gt;The INTNX function advances the date value (in macrovar D) by 1 month.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Sat, 05 Jan 2019 05:42:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524787#M4831</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2019-01-05T05:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate this string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524795#M4832</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
start='01feb2017'd;
end='05may2018'd;
length want $ 800;
do i=start to end ;
 if month(i) ne month then do;
   want=catx(',',want,cats('IND_',put(i,monyy5.)));
 end;
 month=month(i);
end;

put want=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 05 Jan 2019 10:41:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524795#M4832</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-01-05T10:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate this string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524800#M4835</link>
      <description>&lt;P&gt;I'm interested. Why do you want a string like that?&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jan 2019 11:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524800#M4835</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-01-05T11:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate this string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524940#M4871</link>
      <description>&lt;P&gt;Thank you very much. It works!&lt;/P&gt;&lt;P&gt;The string contains field names form a dateset which is updated monthly with a new&amp;nbsp; field name added to it.&lt;/P&gt;&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 23:07:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524940#M4871</guid>
      <dc:creator>JP1234</dc:creator>
      <dc:date>2019-01-06T23:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate this string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524942#M4872</link>
      <description>&lt;P&gt;Thanks! Perfect!&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 23:09:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524942#M4872</guid>
      <dc:creator>JP1234</dc:creator>
      <dc:date>2019-01-06T23:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate this string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524943#M4873</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jan 2019 23:12:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524943#M4873</guid>
      <dc:creator>JP1234</dc:creator>
      <dc:date>2019-01-06T23:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to generate this string</title>
      <link>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524987#M4884</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253536"&gt;@JP1234&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you very much. It works!&lt;/P&gt;
&lt;P&gt;The string contains field names form a dateset which is updated monthly with a new&amp;nbsp; field name added to it.&lt;/P&gt;
&lt;P&gt;Jeff&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Adding fields every month is only necessary if the data is stored in variable-names. That is bad design and fixing it almost always allows easier using of the data.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 08:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/how-to-generate-this-string/m-p/524987#M4884</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-01-07T08:27:33Z</dc:date>
    </item>
  </channel>
</rss>

