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"

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

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