<?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: Store variable values in a list in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Store-variable-values-in-a-list/m-p/983987#M43679</link>
    <description>&lt;P&gt;Do you mean something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let myList=("the reference date", "the hospitalization date", "the hospitalization status", "the relapse");

data _null_;
  do x = "the reference date", "the noref date";
    if x IN &amp;amp;myList. then put "A"; else put "B";
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
    <pubDate>Tue, 24 Feb 2026 17:17:22 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2026-02-24T17:17:22Z</dc:date>
    <item>
      <title>Store variable values in a list</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Store-variable-values-in-a-list/m-p/983983#M43678</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;
&lt;P&gt;I have a variable that takes different values (char).&lt;/P&gt;
&lt;P&gt;In a code written to perform some calculations, the if-then-else loop is used different times to execute operations.&lt;/P&gt;
&lt;P&gt;In all if-then-else loops, only variable values in ("the reference date", "the hospitalization date", "the hospitalization status", "the relapse") are considered and not the remaining ones. Is there a way to put those values in a variable so that it is not necessary to specify every time the list of values that should be considered?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I mean something like this:&amp;nbsp;&lt;SPAN&gt;%let&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;varlist= .... but in my case I have not variables but values of a variable.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you in advance&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Feb 2026 17:00:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Store-variable-values-in-a-list/m-p/983983#M43678</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2026-02-24T17:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Store variable values in a list</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Store-variable-values-in-a-list/m-p/983987#M43679</link>
      <description>&lt;P&gt;Do you mean something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let myList=("the reference date", "the hospitalization date", "the hospitalization status", "the relapse");

data _null_;
  do x = "the reference date", "the noref date";
    if x IN &amp;amp;myList. then put "A"; else put "B";
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 24 Feb 2026 17:17:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Store-variable-values-in-a-list/m-p/983987#M43679</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2026-02-24T17:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Store variable values in a list</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Store-variable-values-in-a-list/m-p/983988#M43680</link>
      <description>&lt;P&gt;You could use PROC SQL similar to the following:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;146  proc sql noprint;
147   select name into :val_list separated by ','
148   from sashelp.class;
149  quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.05 seconds
      cpu time            0.00 seconds


150  %put &amp;amp;val_list;
Alfred,Alice,Barbara,Carol,Henry,James,Jane,Janet,Jeffrey,John,Joyce,Judy,Louise,Mary,Philip,Robert,Ro
nald,Thomas,William
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Feb 2026 17:20:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Store-variable-values-in-a-list/m-p/983988#M43680</guid>
      <dc:creator>Kathryn_SAS</dc:creator>
      <dc:date>2026-02-24T17:20:16Z</dc:date>
    </item>
  </channel>
</rss>

