<?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 code this logic: If variable in data set then in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-this-logic-If-variable-in-data-set-then/m-p/590503#M169012</link>
    <description>&lt;P&gt;Get the names of variables in a dataset from dictionary.columns or sashelp.vcolumn:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let present=0;

data _null_;
set sashelp.vcolumn (where=(libname = 'XX' and memname = 'VALUES' and upcase(name) = 'VALUE2'));
call symputx('present',1);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you can run code later on the condition &amp;amp;present.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Sep 2019 17:56:54 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-09-20T17:56:54Z</dc:date>
    <item>
      <title>How to code this logic: If variable in data set then</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-this-logic-If-variable-in-data-set-then/m-p/590492#M169003</link>
      <description>&lt;P&gt;Hey guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this is a simple one, but I wasnt able to find anything on it when I googled. I have a dataset called values that holds 5 values and I want to do a check if my variable x is in that dataset so I can do if then logic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;values = value1, value2, value3, value4, value5&lt;/P&gt;&lt;P&gt;x = value2&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if x in values then...&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 17:36:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-this-logic-If-variable-in-data-set-then/m-p/590492#M169003</guid>
      <dc:creator>gmuersch</dc:creator>
      <dc:date>2019-09-20T17:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to code this logic: If variable in data set then</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-this-logic-If-variable-in-data-set-then/m-p/590497#M169008</link>
      <description>&lt;P&gt;It is not at all clear what you are asking.&amp;nbsp; Please provide a simple example of input data and output data and explain the logic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you mean by "variable in data set"?&amp;nbsp; Just the existence of the variable?&amp;nbsp; Or is there some property of the variable's value that you want to test?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In general if you reference a variable in your code that doesn't exist in the input data then SAS will just create it and leave the values as missing until you assign some value in the code.&amp;nbsp; Is that what you want to happen?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 17:49:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-this-logic-If-variable-in-data-set-then/m-p/590497#M169008</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-09-20T17:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to code this logic: If variable in data set then</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-code-this-logic-If-variable-in-data-set-then/m-p/590503#M169012</link>
      <description>&lt;P&gt;Get the names of variables in a dataset from dictionary.columns or sashelp.vcolumn:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let present=0;

data _null_;
set sashelp.vcolumn (where=(libname = 'XX' and memname = 'VALUES' and upcase(name) = 'VALUE2'));
call symputx('present',1);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you can run code later on the condition &amp;amp;present.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2019 17:56:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-code-this-logic-If-variable-in-data-set-then/m-p/590503#M169012</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-20T17:56:54Z</dc:date>
    </item>
  </channel>
</rss>

