<?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 Program to find a variable in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Program-to-find-a-variable/m-p/319889#M21438</link>
    <description>&lt;P&gt;Dear Users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to SAS so I'm not entirely sure if something like this is even possible so would apologies if it's not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At present I have a dataset which has information on over 1,000,000 individuals. Moreover, the dataset also consists of over 400 variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like to do is aggregate each variable to get a total and then compare each total to a particular number to understand if there's a match.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'd like to tell SAS to sum variable x1 then x2, x3, all the way to x400.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From there I'd like to be able to see does the aggregate of x1 = 500, or does x2, x3 etc. Simply put does any of these 400 variables match 500 and if so which one.&lt;/P&gt;&lt;P&gt;Hopefully, I've been clear on what I'd like to do and any comments would be great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Sean&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2016 12:24:58 GMT</pubDate>
    <dc:creator>Sean_OConnor</dc:creator>
    <dc:date>2016-12-19T12:24:58Z</dc:date>
    <item>
      <title>Program to find a variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Program-to-find-a-variable/m-p/319889#M21438</link>
      <description>&lt;P&gt;Dear Users,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm new to SAS so I'm not entirely sure if something like this is even possible so would apologies if it's not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At present I have a dataset which has information on over 1,000,000 individuals. Moreover, the dataset also consists of over 400 variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I would like to do is aggregate each variable to get a total and then compare each total to a particular number to understand if there's a match.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'd like to tell SAS to sum variable x1 then x2, x3, all the way to x400.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From there I'd like to be able to see does the aggregate of x1 = 500, or does x2, x3 etc. Simply put does any of these 400 variables match 500 and if so which one.&lt;/P&gt;&lt;P&gt;Hopefully, I've been clear on what I'd like to do and any comments would be great.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Sean&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 12:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Program-to-find-a-variable/m-p/319889#M21438</guid>
      <dc:creator>Sean_OConnor</dc:creator>
      <dc:date>2016-12-19T12:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Program to find a variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Program-to-find-a-variable/m-p/319894#M21439</link>
      <description>&lt;P&gt;Your best bet for more help is to post sample data and expected output. &lt;BR /&gt;Because you have 400 variables you may also want to thoroughly familiarize yourself with variables lists, ways to reference variables withou explcilty typing each name.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you coding or using GUI (tasks) &amp;nbsp;in EG?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For summarizing data use PROC MEANS/SUMMARY&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For filtering ata across a wide range of variables look at WHICHN function with a data step and/or an Array.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your best bet for more help is to post sample data and expected output.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because you have 400 variables you may also want to thoroughly familiarize yourself with variables lists, ways to reference variables withou explcilty typing each name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 12:38:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Program-to-find-a-variable/m-p/319894#M21439</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-19T12:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Program to find a variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Program-to-find-a-variable/m-p/319896#M21440</link>
      <description>&lt;P&gt;You can define an array over those variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array all_my_xs {*} x1=x400;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you can loop through the array.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 12:40:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Program-to-find-a-variable/m-p/319896#M21440</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-12-19T12:40:47Z</dc:date>
    </item>
    <item>
      <title>Re: Program to find a variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Program-to-find-a-variable/m-p/319927#M21442</link>
      <description>&lt;P&gt;If you're new to SAS, I suspect you need a little more guidance on this.&amp;nbsp; This would be a good starting point:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc summary data=have;&lt;/P&gt;
&lt;P&gt;var _numeric_;&lt;/P&gt;
&lt;P&gt;output out=stats (drop=_type_ _freq_) sum=;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This gives you a data set named STATS with a single observation.&amp;nbsp; All the original variable names are there, but they now hold the sum across all the original observations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To search for all variables with a sum of 500, you could proceed:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data vars_500;&lt;/P&gt;
&lt;P&gt;set stats;&lt;/P&gt;
&lt;P&gt;length varname $ 32;&lt;/P&gt;
&lt;P&gt;array nums {*} _numeric_;&lt;/P&gt;
&lt;P&gt;do _n_=1 to dim(nums);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; if nums{_n_}=500 then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; varname = vname(nums{_n_});&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In VARS_500, you will have a list of all variable names that summed to 500.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2016 14:32:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Program-to-find-a-variable/m-p/319927#M21442</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-12-19T14:32:53Z</dc:date>
    </item>
  </channel>
</rss>

