<?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: Store specific observation in variable with proc sql in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/612002#M18273</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3081"&gt;@Cello23&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It depends on what you want to get:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data A001;
	input NAMES	$ CASH;
	datalines;
MARIO 100
LUCA 122
MARCO 300
;
run;
 
/* &amp;amp;Filter will contain: MARIO LUCA MARCO */

proc sql noprint ;
	select NAMES
	into : Filter separated by " "
	from A001;
quit;

/* &amp;amp;Filter1 will contain MARIO, &amp;amp;Filter2 will contain LUCA, ... */
proc sql noprint ;
	select NAMES
	into : Filter1-:Filter999
	from A001;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 16 Dec 2019 12:43:08 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2019-12-16T12:43:08Z</dc:date>
    <item>
      <title>Store specific observation in variable with proc sql</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/611999#M18271</link>
      <description>&lt;P&gt;&lt;SPAN&gt;hi,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;i have a table (A001) like this:&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE width="264"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="136"&gt;NAMES&lt;/TD&gt;
&lt;TD width="128"&gt;CASH&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;MARIO&lt;/TD&gt;
&lt;TD&gt;100&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;LUCA&lt;/TD&gt;
&lt;TD&gt;122&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;MARCO&lt;/TD&gt;
&lt;TD&gt;300&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how can I store a &lt;U&gt;specific observation &lt;/U&gt;(1° row "MARIO" or 2° row "LUCA" or 3° row "MARCO")&amp;nbsp;of the column "NAMES"&amp;nbsp; of table A001, in the variable FILTER, with&amp;nbsp; "proc sql"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql&amp;nbsp; noprint ;&lt;BR /&gt;select NAMES into : Filter&lt;BR /&gt;from &lt;SPAN&gt;A001&lt;/SPAN&gt;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, 2° record ( "LUCA" -&amp;gt; FILTER)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thank's&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 12:37:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/611999#M18271</guid>
      <dc:creator>Cello23</dc:creator>
      <dc:date>2019-12-16T12:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Store specific observation in variable with proc sql</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/612000#M18272</link>
      <description>&lt;P&gt;Do you mean&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql  noprint ;
select quote(NAMES) into : Filter separated by ','
from A001
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Dec 2019 12:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/612000#M18272</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-16T12:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Store specific observation in variable with proc sql</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/612002#M18273</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3081"&gt;@Cello23&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It depends on what you want to get:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data A001;
	input NAMES	$ CASH;
	datalines;
MARIO 100
LUCA 122
MARCO 300
;
run;
 
/* &amp;amp;Filter will contain: MARIO LUCA MARCO */

proc sql noprint ;
	select NAMES
	into : Filter separated by " "
	from A001;
quit;

/* &amp;amp;Filter1 will contain MARIO, &amp;amp;Filter2 will contain LUCA, ... */
proc sql noprint ;
	select NAMES
	into : Filter1-:Filter999
	from A001;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Dec 2019 12:43:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/612002#M18273</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2019-12-16T12:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Store specific observation in variable with proc sql</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/612003#M18274</link>
      <description>&lt;P&gt;Sounds like a silly request.&amp;nbsp; SQL does not have a concept or order of data.&amp;nbsp; But SAS does. So you could use dataset options to tell SAS to start reading a dataset at a specific observation number and end at another (equal or greater) observation number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SQL is not really the right tool for that operation. You will have much more flexibility using normal data step code instead.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 set a001 (firstobs=1 obs=1);
 call symputx('filter',names);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you can do it in SQL if you must.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select names into :filter trimmed
  from a001(firstobs=1 obs=1)
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Make sure to use the TRIMMED keyword to prevent the trailing spaces from being stored into the macro variable.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 12:47:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/612003#M18274</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-16T12:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: Store specific observation in variable with proc sql</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/612010#M18275</link>
      <description>&lt;P&gt;I need to store into variabile FILTER single string, start first observation to last observation (with macro cicle DO WHILE where INDEX are the number of observation table A001):&lt;/P&gt;
&lt;P&gt;1° first rows FILTER = 'MARIO"&lt;/P&gt;
&lt;P&gt;2° second rows FILTER = 'LUCA'&lt;/P&gt;
&lt;P&gt;3°&amp;nbsp; last row FILTER = 'MARCO'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the sintax of PROC SQL to store single specific observation (not string) ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;THANk'S!!!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 13:13:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/612010#M18275</guid>
      <dc:creator>Cello23</dc:creator>
      <dc:date>2019-12-16T13:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Store specific observation in variable with proc sql</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/612013#M18276</link>
      <description>&lt;P&gt;thank you&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 13:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Store-specific-observation-in-variable-with-proc-sql/m-p/612013#M18276</guid>
      <dc:creator>Cello23</dc:creator>
      <dc:date>2019-12-16T13:22:20Z</dc:date>
    </item>
  </channel>
</rss>

