<?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 select into: how to save blank value in macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745841#M233886</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following code to read all values in column ccv_date_variabel into macro variables var1 - varn .&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
   select strip(CCV_date_variable) into : var1 - 
   from &amp;amp;SPEC;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The problem is there are some values are blank,&amp;nbsp; what I want is var1 has value blank and var2 has value "AESTDAT_RAW", but what I got is var1 equal to "AESTDAT_RAW". Could anyone please advise how can I solve this? thank you&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="screenshot.jpg" style="width: 389px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60030i6F8C3709CED92F05/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot.jpg" alt="screenshot.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Jun 2021 16:25:23 GMT</pubDate>
    <dc:creator>tinaz5012</dc:creator>
    <dc:date>2021-06-04T16:25:23Z</dc:date>
    <item>
      <title>Proc select into: how to save blank value in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745841#M233886</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following code to read all values in column ccv_date_variabel into macro variables var1 - varn .&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
   select strip(CCV_date_variable) into : var1 - 
   from &amp;amp;SPEC;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The problem is there are some values are blank,&amp;nbsp; what I want is var1 has value blank and var2 has value "AESTDAT_RAW", but what I got is var1 equal to "AESTDAT_RAW". Could anyone please advise how can I solve this? thank you&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="screenshot.jpg" style="width: 389px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60030i6F8C3709CED92F05/image-size/large?v=v2&amp;amp;px=999" role="button" title="screenshot.jpg" alt="screenshot.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 16:25:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745841#M233886</guid>
      <dc:creator>tinaz5012</dc:creator>
      <dc:date>2021-06-04T16:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proc select into: how to save blank value in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745847#M233891</link>
      <description>&lt;P&gt;You might provide just exactly how you intend to use that macro variable &amp;amp;var1.&lt;/P&gt;
&lt;P&gt;How it is used would affect what the content should look like.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 16:32:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745847#M233891</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-04T16:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: Proc select into: how to save blank value in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745849#M233893</link>
      <description>&lt;P&gt;I don't understand what you want&amp;nbsp;that is different than what PROC SQL already generates.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  input x $10.;
cards;
 
ab
cd
 
ef
;
proc sql noprint;
 select x into :x1-  from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;2405  %put &amp;amp;=sqlobs &amp;amp;=x1 &amp;amp;=x3 &amp;amp;=x5 ;
SQLOBS=5 X1= X3=cd X5=ef
2406  %put x1=%length(&amp;amp;x1) x2=%length(&amp;amp;x2);
x1=0 x2=2
&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Jun 2021 16:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745849#M233893</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-04T16:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc select into: how to save blank value in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745850#M233894</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;, but you can also do it this way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
length abc $ 10;
abc='';       output;
abc='azerty'; output;
abc='querty'; output;
run;
data _NULL;
 set have;
 call symput('var'!!strip(put(_N_,5.)),abc);
run;
%PUT &amp;amp;=var1; %PUT &amp;amp;=var2; %PUT &amp;amp;=var3;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 16:39:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745850#M233894</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-06-04T16:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Proc select into: how to save blank value in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745851#M233895</link>
      <description>&lt;P&gt;CALL SYMPUT() will allow you to include leading/trailing spaces in the generated macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you want the empty values generate a macro variable with exactly one space in it you need to use CALL SYMPUT() and also use TRIM(LEFT()) instead of STRIP() to preserve that single space.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set &amp;amp;spec ;
  call symput(cats('var',_n_),trim(left(CCV_date_variable)));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 17:04:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745851#M233895</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-04T17:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: Proc select into: how to save blank value in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745868#M233907</link>
      <description>&lt;P&gt;Thank you for your help, appreciate it!&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 17:54:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-select-into-how-to-save-blank-value-in-macro-variable/m-p/745868#M233907</guid>
      <dc:creator>tinaz5012</dc:creator>
      <dc:date>2021-06-04T17:54:17Z</dc:date>
    </item>
  </channel>
</rss>

