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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 1386 views
  • 0 likes
  • 2 in conversation