sas proc iml and data set

Reply
Super Contributor
Posts: 371

sas proc iml and data set

I have this code:

data you;

  g=45;

run;

proc iml;

.....

....

create you....;

qui;

If the proc iml has an error, it does not replace the data set : you.

so, I have used the sas option : options replace;

why ?

Super User
Posts: 10,020

Re: sas proc iml and data set

Look good for me .  If it is a IML question, Post it at IML Forum, Rick is there.

Code: Program

data have;
set sashelp.class;
run;

proc iml;
x=(1:9);
create have var {x};
append;
close have;
quit;


Log: Program

Notes (9)

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

53 

54 data have;

55 set sashelp.class;

56 run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.

NOTE: The data set WORK.HAVE has 19 observations and 5 variables.

NOTE: Compressing data set WORK.HAVE increased size by 100.00 percent.

  Compressed is 2 pages; un-compressed would require 1 pages.

NOTE: DATA statement used (Total process time):

  real time 0.29 seconds

  cpu time 0.17 seconds

  

57 

58 proc iml;

NOTE: IML Ready

59 x=(1:9);

60 create have var {x};

NOTE: Compression was disabled for data set WORK.HAVE because compression overhead would increase the size of the data set.

61 append;

62 close have;

NOTE: The data set WORK.HAVE has 9 observations and 1 variables.

63 quit;

NOTE: Exiting IML.

NOTE: PROCEDURE IML used (Total process time):

  real time 0.02 seconds

  cpu time 0.01 seconds

  

64 

65 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

75 

SAS Super FREQ
Posts: 3,752

Re: sas proc iml and data set

If you write

CREATE you FROM X;

and X does not exist, then the CREATE statement fails, which is why the statement does not get replaced.

If the CREATE statement succeeds, but then an error occurs on the APPEND statement, the YOU data will be replaced by one that has zero observations.

Ask a Question
Discussion stats
  • 2 replies
  • 220 views
  • 0 likes
  • 3 in conversation