<?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: dataset with variable that is a list of strings in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717637#M27534</link>
    <description>&lt;P&gt;I'm using prior_years as the criteria in proc sql and this format has always worked:&lt;/P&gt;&lt;PRE class="lia-code-sample  language-sas"&gt;&lt;CODE&gt;prior_years = ("1988","1999","2000");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm just trying to store the current value of prior_years in a data set so that I have it for future reference. I also capture the current date and other stuff so that I can look back at it and see what values I used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Feb 2021 16:28:30 GMT</pubDate>
    <dc:creator>tedway</dc:creator>
    <dc:date>2021-02-08T16:28:30Z</dc:date>
    <item>
      <title>dataset with variable that is a list of strings</title>
      <link>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717593#M27526</link>
      <description>&lt;P&gt;I have a variable that is a list of years in character format, and I want to save the value in a data set for future reference.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's what I tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let prior_years = ("1988","1999","2000");
data test;
test = &amp;amp;prior_term;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And I get this error.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;30 ("202040","99999","89898")
_
388
200
ERROR 388-185: Expecting an arithmetic operator.

ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I could do this and it works, but I don't want to change the format for the prior_years variable:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let prior_years = (1988,2000);
data test;
test = "&amp;amp;prior_years";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 15:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717593#M27526</guid>
      <dc:creator>tedway</dc:creator>
      <dc:date>2021-02-08T15:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: dataset with variable that is a list of strings</title>
      <link>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717610#M27529</link>
      <description>&lt;P&gt;What's your previous experience with programming?&amp;nbsp; I am curious.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can do this &lt;A href="https://en.wikipedia.org/wiki/Wide_and_narrow_data" target="_self"&gt;the "wide" way or the "narrow" way&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;the wide:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want_wide;
  year1 =1988;
  year2 =1999;
  year3 =2000;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;the narrow:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want_narrow;
  year =1988; output;
  year =1999; output;
  year =2000; output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Feb 2021 15:54:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717610#M27529</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-02-08T15:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: dataset with variable that is a list of strings</title>
      <link>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717611#M27530</link>
      <description>&lt;P&gt;A variable that has a list of items would typically look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data example;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; var = "1998, 1999, 2011";&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Quotes inside values are typically a very bad idea.&lt;/P&gt;
&lt;P&gt;So, why do you have quotes and a delimiter in the value?.&lt;/P&gt;
&lt;P&gt;And your example code creates one macro variable an then uses a different one.&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;%let prior_years = ("1988","1999","2000");
data test;
test = &amp;amp;prior_term;
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp; it would make, slightly, more sense to do.&lt;/P&gt;
&lt;PRE&gt;%let prior_years =1988,1999,2000;
data test;
test = "&amp;amp;prior_years";
run;&lt;/PRE&gt;
&lt;P&gt;The question is why is a macro variable involved at all?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 15:54:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717611#M27530</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-08T15:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: dataset with variable that is a list of strings</title>
      <link>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717622#M27531</link>
      <description>&lt;P&gt;Are you expecting a result like this one?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Test.PNG" style="width: 495px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54461i068D6F575DD3DD6C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Test.PNG" alt="Test.PNG" /&gt;&lt;/span&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>Mon, 08 Feb 2021 16:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717622#M27531</guid>
      <dc:creator>Dani_Gor</dc:creator>
      <dc:date>2021-02-08T16:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: dataset with variable that is a list of strings</title>
      <link>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717628#M27532</link>
      <description>&lt;P&gt;Yes.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 16:18:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717628#M27532</guid>
      <dc:creator>tedway</dc:creator>
      <dc:date>2021-02-08T16:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: dataset with variable that is a list of strings</title>
      <link>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717635#M27533</link>
      <description>&lt;P&gt;I think this code may solve your problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let prior_years = ("1988","1999","2000");&lt;BR /&gt;%let list=%tslit(&amp;amp;prior_years);&lt;BR /&gt;%put &amp;amp;=list;&lt;BR /&gt;data test;&lt;BR /&gt;test = &amp;amp;list;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;documentation at this link:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lebaseutilref&amp;amp;docsetTarget=n1phgnraoodvpln1bm941n44yq7q.htm&amp;amp;locale=en" target="_blank"&gt;https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lebaseutilref&amp;amp;docsetTarget=n1phgnraoodvpln1bm941n44yq7q.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 16:23:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717635#M27533</guid>
      <dc:creator>Dani_Gor</dc:creator>
      <dc:date>2021-02-08T16:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: dataset with variable that is a list of strings</title>
      <link>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717637#M27534</link>
      <description>&lt;P&gt;I'm using prior_years as the criteria in proc sql and this format has always worked:&lt;/P&gt;&lt;PRE class="lia-code-sample  language-sas"&gt;&lt;CODE&gt;prior_years = ("1988","1999","2000");&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm just trying to store the current value of prior_years in a data set so that I have it for future reference. I also capture the current date and other stuff so that I can look back at it and see what values I used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 16:28:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717637#M27534</guid>
      <dc:creator>tedway</dc:creator>
      <dc:date>2021-02-08T16:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: dataset with variable that is a list of strings</title>
      <link>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717639#M27535</link>
      <description>That works great. Thank!</description>
      <pubDate>Mon, 08 Feb 2021 16:30:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/dataset-with-variable-that-is-a-list-of-strings/m-p/717639#M27535</guid>
      <dc:creator>tedway</dc:creator>
      <dc:date>2021-02-08T16:30:31Z</dc:date>
    </item>
  </channel>
</rss>

