<?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 proc sql select multiple variables with same words in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-select-multiple-variables-with-same-words/m-p/545128#M150768</link>
    <description>&lt;P&gt;Hello. I have a problem with selecting multiple variable in proc sql.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data's variables are as follows....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID pre_stress_visit1&amp;nbsp;&amp;nbsp;pre_stress_visit2&amp;nbsp;pre_stress_visit3&amp;nbsp;post_stress_visit1&amp;nbsp;post_stress_visit2&amp;nbsp;post_stress_visit3 pre_pain_visit1&lt;/P&gt;&lt;P&gt;A 12 10 9 10 8 7 53 ...&lt;/P&gt;&lt;P&gt;B 13 13 6 11 11 4 57 ...&lt;/P&gt;&lt;P&gt;C 13 12 8 10 13 7 55 ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to select variables with same words, 'stress'. So, I want to select.(Maybe you can find that i want to calculate difference between pre_post stress in every visit)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"ID&lt;/P&gt;&lt;P&gt;pre_stress_visit1&lt;/P&gt;&lt;P&gt;pre_stress_visit2&lt;/P&gt;&lt;P&gt;pre_stress_visit3&lt;/P&gt;&lt;P&gt;post_stress_visit1&lt;/P&gt;&lt;P&gt;post_stress_visit2&lt;/P&gt;&lt;P&gt;post_stress_visit3"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use 'array' function, but it didn't work in proc sql. Is there a better way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would really appreciate all your help. thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Mar 2019 05:45:51 GMT</pubDate>
    <dc:creator>km0927</dc:creator>
    <dc:date>2019-03-22T05:45:51Z</dc:date>
    <item>
      <title>proc sql select multiple variables with same words</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-select-multiple-variables-with-same-words/m-p/545128#M150768</link>
      <description>&lt;P&gt;Hello. I have a problem with selecting multiple variable in proc sql.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My data's variables are as follows....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID pre_stress_visit1&amp;nbsp;&amp;nbsp;pre_stress_visit2&amp;nbsp;pre_stress_visit3&amp;nbsp;post_stress_visit1&amp;nbsp;post_stress_visit2&amp;nbsp;post_stress_visit3 pre_pain_visit1&lt;/P&gt;&lt;P&gt;A 12 10 9 10 8 7 53 ...&lt;/P&gt;&lt;P&gt;B 13 13 6 11 11 4 57 ...&lt;/P&gt;&lt;P&gt;C 13 12 8 10 13 7 55 ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to select variables with same words, 'stress'. So, I want to select.(Maybe you can find that i want to calculate difference between pre_post stress in every visit)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"ID&lt;/P&gt;&lt;P&gt;pre_stress_visit1&lt;/P&gt;&lt;P&gt;pre_stress_visit2&lt;/P&gt;&lt;P&gt;pre_stress_visit3&lt;/P&gt;&lt;P&gt;post_stress_visit1&lt;/P&gt;&lt;P&gt;post_stress_visit2&lt;/P&gt;&lt;P&gt;post_stress_visit3"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use 'array' function, but it didn't work in proc sql. Is there a better way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would really appreciate all your help. thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2019 05:45:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-select-multiple-variables-with-same-words/m-p/545128#M150768</guid>
      <dc:creator>km0927</dc:creator>
      <dc:date>2019-03-22T05:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: proc sql select multiple variables with same words</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-sql-select-multiple-variables-with-same-words/m-p/545129#M150769</link>
      <description>&lt;P&gt;Why do you need to use SQL? It's a lot easier in a DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have (keep = ID pre_stress_visit: post_stress_visit:);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you still want to stick with SQL:&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 *
  from have (keep = ID pre_stress_visit: post_stress_visit:)
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Mar 2019 06:11:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-sql-select-multiple-variables-with-same-words/m-p/545129#M150769</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-03-22T06:11:50Z</dc:date>
    </item>
  </channel>
</rss>

