BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
nketata
Obsidian | Level 7

Hi all,

 

Given this file,

 

DATA HELLO;

year=2004; deptcode="Sales"; output;

year=2005; deptcode="HR";output;

year=.; output;

year=2007; deptcode="Logistics";output;

run;

 

the following program returns a nice table showing the count of missing and non-missing obs :

 

proc iml;

use HELLO nobs nobs;

read point 1 var _NUM_ into x[colname=nNames];

read point 1 var _CHAR_ into x[colname=cNames];

Names = nNames || cNames;

nmiss = j(1,ncol(Names));

n = nmiss;

do i = 1 to ncol(Names);

read all var (Names[i]) into x;

nmiss[i] = countmiss(x,"col");

n[i] = nobs - nmiss[i];

end;

close HELLO;

rNames = {" Missing", "Not Missing"};

cnt = nmiss // n;

*create beta ;

*append from cnt[r=rNames c=Names label=""];

*close beta;

print cnt[r=rNames c=Names label=""];

quit;

 

I am seeking help to save the output table into a file. I wrote an APPEND command (see three lines in green) but the log keeps yelling at me for an error.

 

Thanks.  

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ
create beta from cnt[r=rNames c=Names];
append from cnt[r=rNames];
close beta;

For a discussion ot the CREATE FROM/APPEND FROM syntax, see

"Writing data from a matrix to a data set"

View solution in original post

1 REPLY 1
Rick_SAS
SAS Super FREQ
create beta from cnt[r=rNames c=Names];
append from cnt[r=rNames];
close beta;

For a discussion ot the CREATE FROM/APPEND FROM syntax, see

"Writing data from a matrix to a data set"

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 2062 views
  • 0 likes
  • 2 in conversation