<?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: cross table arithmetic? in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619409#M8684</link>
    <description>&lt;P&gt;Ah, I just tried:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new_table;
	merge new_table want;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and got exactly what I was looking for. Cool. Thanks for your help ya'll!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jan 2020 05:14:03 GMT</pubDate>
    <dc:creator>schlepro</dc:creator>
    <dc:date>2020-01-23T05:14:03Z</dc:date>
    <item>
      <title>cross table arithmetic?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619400#M8680</link>
      <description>&lt;P&gt;Hi SAS Helpers!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Very basic question for you about using variables in one table with variables in another table. Using SAS university edition. I'm trying to do arithmetic with the mean and standard deviation of a column in order to set another column as a one or zero depending on whether a different column is &amp;gt;= mean() plus std() in order to do some feature engineering, but my code doesn't work as intended. Please assist!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile='/folders/myfolders/cross_table_example.xlsx'
	out = new_table
	dbms = xlsx
	replace;

proc sql;
	create table want as
		select mean(Watch)+std(Watch) as OneDev
  		from new_table;
quit;

* Doesn't work as intended. Get column of all ones;
data new_table;
	set new_table want; * sets the row after the last row of data with what's in want?;
	freqWatcher = 1*(Watch&amp;gt;=OneDev);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks for your help ya'll!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 04:12:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619400#M8680</guid>
      <dc:creator>schlepro</dc:creator>
      <dc:date>2020-01-23T04:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: cross table arithmetic?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619402#M8681</link>
      <description>SET stacks the two data sets on top of each other. You want a merge of types but it's different because you want the value to merge with all other rows you have. &lt;BR /&gt;&lt;BR /&gt;I show two methods of doing this here:&lt;BR /&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/add_average_value_to_dataset.sas" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/add_average_value_to_dataset.sas&lt;/A&gt;</description>
      <pubDate>Thu, 23 Jan 2020 04:16:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619402#M8681</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-01-23T04:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: cross table arithmetic?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619403#M8682</link>
      <description>&lt;P&gt;I don't see what is the purpose of table mean_dev. But you seem to want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table want as
		select *, Watch &amp;gt;= mean(Watch)+std(Watch) as freqWatcher
  		from new_table;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jan 2020 04:16:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619403#M8682</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-01-23T04:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: cross table arithmetic?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619408#M8683</link>
      <description>&lt;P&gt;I didn't even think of trying to do it all in SQL. I feel a little sheepish. My bad on mean_dev. I used old junk data to build the post and included more than I needed. I edited the post, but without explanation, so it might have been a little confusing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Follow Up question. How would you put freqWatcher in new_table using native/base SAS? Is that where merge would come in?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 05:04:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619408#M8683</guid>
      <dc:creator>schlepro</dc:creator>
      <dc:date>2020-01-23T05:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: cross table arithmetic?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619409#M8684</link>
      <description>&lt;P&gt;Ah, I just tried:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data new_table;
	merge new_table want;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and got exactly what I was looking for. Cool. Thanks for your help ya'll!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2020 05:14:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619409#M8684</guid>
      <dc:creator>schlepro</dc:creator>
      <dc:date>2020-01-23T05:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: cross table arithmetic?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619598#M8686</link>
      <description>No, that won't work. Check the link I posted to explain how you would need to do it. That would only bring the value to the first row of the data set but if you only have one I guess that's fine.</description>
      <pubDate>Thu, 23 Jan 2020 17:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/cross-table-arithmetic/m-p/619598#M8686</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-01-23T17:22:38Z</dc:date>
    </item>
  </channel>
</rss>

