<?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 Base SAS array in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Base-SAS-array/m-p/576823#M163335</link>
    <description>&lt;P&gt;Dear Members,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've a dataset which contain missing and non missing values. The "Spec" dataset contains the information about first dataset. I wanted to check missing values variable and wanted to create one more dataset which should contain the original dataset with one extra variable . I got stuck how i can concatenate variable names.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;Output wanted:&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;a b c Missing_Details&lt;/P&gt;&lt;P&gt;1 . a1 B is missing&lt;BR /&gt;. 2 b2 A is missing&lt;BR /&gt;. . A is missing,B is missing,C is missing&lt;BR /&gt;1 2 c3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile datalines;
input a b c $1.;
datalines;
1 . a
. 2 b
. .  
1 2 c
;
run;

data Spec;
input Req  name $ TYPE $;
datalines;
0 a NUM
0 b NUM
0 C CHAR
;
run;

proc sql;
select name into :name1 SEPARATED by ' ' from spec WHERE TYPE EQ 'NUM';
select name into :name_CH1 SEPARATED by ' ' from spec WHERE TYPE EQ 'CHAR';
quit;

OPTIONS MPRINT MLOGIC SYMBOLGEN;

DATA _NULL;
SET TEST;
ARRAY ARR[*] &amp;amp;name1;
array arr1[*] &amp;amp;name_ch1;
DO J=1 TO dim(ARR);
  IF MISSING(ARR[J]) THEN MISS='MISSING';
 END; 
 DO i=1 TO dim(arr1);
  IF MISSING(ARR1[i]) THEN MISS='MISSING';
END;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you everyone in advance !!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jul 2019 07:40:10 GMT</pubDate>
    <dc:creator>singhsahab</dc:creator>
    <dc:date>2019-07-26T07:40:10Z</dc:date>
    <item>
      <title>Base SAS array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Base-SAS-array/m-p/576823#M163335</link>
      <description>&lt;P&gt;Dear Members,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've a dataset which contain missing and non missing values. The "Spec" dataset contains the information about first dataset. I wanted to check missing values variable and wanted to create one more dataset which should contain the original dataset with one extra variable . I got stuck how i can concatenate variable names.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;Output wanted:&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;a b c Missing_Details&lt;/P&gt;&lt;P&gt;1 . a1 B is missing&lt;BR /&gt;. 2 b2 A is missing&lt;BR /&gt;. . A is missing,B is missing,C is missing&lt;BR /&gt;1 2 c3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
infile datalines;
input a b c $1.;
datalines;
1 . a
. 2 b
. .  
1 2 c
;
run;

data Spec;
input Req  name $ TYPE $;
datalines;
0 a NUM
0 b NUM
0 C CHAR
;
run;

proc sql;
select name into :name1 SEPARATED by ' ' from spec WHERE TYPE EQ 'NUM';
select name into :name_CH1 SEPARATED by ' ' from spec WHERE TYPE EQ 'CHAR';
quit;

OPTIONS MPRINT MLOGIC SYMBOLGEN;

DATA _NULL;
SET TEST;
ARRAY ARR[*] &amp;amp;name1;
array arr1[*] &amp;amp;name_ch1;
DO J=1 TO dim(ARR);
  IF MISSING(ARR[J]) THEN MISS='MISSING';
 END; 
 DO i=1 TO dim(arr1);
  IF MISSING(ARR1[i]) THEN MISS='MISSING';
END;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you everyone in advance !!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 07:40:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Base-SAS-array/m-p/576823#M163335</guid>
      <dc:creator>singhsahab</dc:creator>
      <dc:date>2019-07-26T07:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Base SAS array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Base-SAS-array/m-p/576833#M163340</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
    infile datalines;
    input a b c $1.;

    array n _NUMERIC_;
    array ch _CHARACTER_;

    length miss $200;

    do over n;
        if missing(n) then miss=catx(' ', miss, vname(n), 'is missing');
    end;

    do over ch;
        if missing(ch) then miss=catx(' ', miss, vname(ch), 'is missing');
    end;

    datalines;
1 . a
. 2 b
. . . 
1 2 c
;
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Jul 2019 08:35:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Base-SAS-array/m-p/576833#M163340</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2019-07-26T08:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Base SAS array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Base-SAS-array/m-p/576835#M163341</link>
      <description>&lt;P&gt;Using what you've posted here a solution approach.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want(drop=i j);
  SET TEST;
  ARRAY ARR[*] &amp;amp;name1;
  array arr1[*] &amp;amp;name_ch1;
  length Missing_Details $120;

  DO J=1 TO dim(ARR);
    IF MISSING(ARR[J]) THEN
      Missing_Details=catx(',',Missing_Details,vname(ARR[J]));
  END;

  DO i=1 TO dim(arr1);
    IF MISSING(ARR1[i]) THEN
      Missing_Details=catx(',',Missing_Details,vname(ARR1[i]));
  END;
RUN;
proc print data=want;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;N.B: The length of variable&amp;nbsp;Missing_Details must be sufficient to hold all the variable names in case they are all missing (=32 characters for the var name plus 1 character for the comma per variable).&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jul 2019 08:57:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Base-SAS-array/m-p/576835#M163341</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-07-26T08:57:33Z</dc:date>
    </item>
  </channel>
</rss>

