<?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 Pass variables from one data set to Proc means in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Pass-variables-from-one-data-set-to-Proc-means/m-p/306778#M65633</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to run data audit( descriptive checks using either proc means/summary), where i want to automate the process.&lt;/P&gt;&lt;P&gt;I had a data set, executed Proc Contents and segregated data for numeric and character variables. I am stuck on how to pass the variable name to Proc means. Please help&lt;/P&gt;</description>
    <pubDate>Mon, 24 Oct 2016 13:51:12 GMT</pubDate>
    <dc:creator>farrukh</dc:creator>
    <dc:date>2016-10-24T13:51:12Z</dc:date>
    <item>
      <title>Pass variables from one data set to Proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pass-variables-from-one-data-set-to-Proc-means/m-p/306778#M65633</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wanted to run data audit( descriptive checks using either proc means/summary), where i want to automate the process.&lt;/P&gt;&lt;P&gt;I had a data set, executed Proc Contents and segregated data for numeric and character variables. I am stuck on how to pass the variable name to Proc means. Please help&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 13:51:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pass-variables-from-one-data-set-to-Proc-means/m-p/306778#M65633</guid>
      <dc:creator>farrukh</dc:creator>
      <dc:date>2016-10-24T13:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: Pass variables from one data set to Proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pass-variables-from-one-data-set-to-Proc-means/m-p/306786#M65636</link>
      <description>&lt;P&gt;You may want to provide specific examplpes - code/test data (form of a datastep). &amp;nbsp;There are of course many ways to address a problem, but probably the simplest in this case is to forget getting lists of variables and do:&lt;/P&gt;
&lt;PRE&gt;proc means...;  
  var _numeric_;
...
run;&lt;/PRE&gt;
&lt;P&gt;There is also a _character_ version. &amp;nbsp;Basically that means a list of all numeric or character variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If its more complicated then maybe call execute:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set sashelp.vcolumn (where=(libname="WORK" and memname="ABC"));
  if type="char" then call execute('proc freq...;');
  else call execute('proc means...;');
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Oct 2016 14:01:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pass-variables-from-one-data-set-to-Proc-means/m-p/306786#M65636</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-10-24T14:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Pass variables from one data set to Proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pass-variables-from-one-data-set-to-Proc-means/m-p/306789#M65638</link>
      <description>&lt;P&gt;You can extract the variable names form sashelp.vcolum and save them in a macro variable and use that variable in proc means:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
   select Name
      into :num_vars separated by " "
      from sashelp.vcolumn
         where LIBNAME = "SASHELP" and MemName = "CLASS" and lowcase(Type) = "num"
   ;
   select Name
      into :char_vars separated by " "
      from sashelp.vcolumn
         where LIBNAME = "SASHELP" and MemName = "CLASS" and lowcase(Type) = "char" and lowcase(Name) ^= "name"
   ;
quit;

%put &amp;amp;num_vars;
%put &amp;amp;char_vars;

proc means data=sashelp.class mean;
   class &amp;amp;char_vars;
   var &amp;amp;num_vars;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Oct 2016 14:03:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pass-variables-from-one-data-set-to-Proc-means/m-p/306789#M65638</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2016-10-24T14:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Pass variables from one data set to Proc means</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Pass-variables-from-one-data-set-to-Proc-means/m-p/306826#M65656</link>
      <description>&lt;P&gt;The simplest possibility of all:&amp;nbsp; remove the VAR statement from PROC MEANS.&amp;nbsp; The default action is to process all numeric variables.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Oct 2016 14:46:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Pass-variables-from-one-data-set-to-Proc-means/m-p/306826#M65656</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-10-24T14:46:03Z</dc:date>
    </item>
  </channel>
</rss>

