DATA Step, Macro, Functions and more

Use of Macros under IVEware

Reply
N/A
Posts: 0

Use of Macros under IVEware

I am a relatively new SAS user. I need to use %impute and %describe for a missing data imputation under IVEware. I get the "apparent invocation of macro (impute or describe or put) not resolved. What am I doing wrong? Here is part of my program:

options set=SRCLIB "C:\Program Files\Srclib"
sasautos=('!SRCLIB' sasautos) mautosource;
LIBNAME 'C:\MYINDIR'; LIBNAME MYOUT 'C:\MYOUTDIR';
DATA _NULL_;
INFILE DATALINES;
FILENAME MYSETUP "IMPUTE SET;
FILE MYSETUP; INPUT;
PUT _INFILE_; DATALINES4; TITLE MULTIPLE IMPUTATION;
DATAIN MYLIB.COMBINED;
DATAOUT MYOUT.IMPUTED1; MDATA IMPUTE;
CONTINUOUS YEARCAN MONCAN YEARHIV MONHIV YEARAIDS MONAIDS AGEHIV AGECAN DEATHMM AGEAIDS DEATHMM YEARDEC; CATEGORICAL GENDER RACE DEC;
TRANSFER MATCH CASE ID DEATHDD DAYCAN DAYHIV DAYAIDS TUMORGR
ICDO PRIMSITE MORPHOL SSTAGE RADIAD SURGERY CHEMO CD4 DAYSHAC
DAYSHAA CAGECAN CAGEAIDS ICDBEH AIDSCASE YRMOCAN YRMOHIV ETHNIC;
RESTRICT AGECAN (YEARCAN NE " ") AGEAIDS (YEARAIDS NE " ");
ITERATIONS 10; MULTIPLES 5;
SEED 100; RUN ;
;;;; Message was edited by: Rose Marie Martin
Super Contributor
Super Contributor
Posts: 3,174

Re: Use of Macros under IVEware

Suggest the Google search to locate a suitable example for your SAS application for Iveware - you will need to set SASAUTOS= but also you need a FILENAME to declare the program/file directory/folder location for your macro programs.

Google search suggested argument: sas impute describe macros iveware

Also, the SAS support http://support.sas.com/ website has SAS-hosted documentation and supplemental technical and conference reference material on use of FILENAME and the OPTIONS SASAUTOS= commands.

After this, if you still have error conditions, suggest you reply to your post with the actual SAS log showing warnings/errors received, rather than attempting to describe any error simply with your partial SAS program code.

Scott Barry
SBBWorks, Inc.
N/A
Posts: 0

Re: Use of Macros under IVEware

Thanks for your help. I am still not able to invoke the macros, but I have stored them where I think they belong. Here is the latest log:

options set=SRCLIB "C:\Program Files\Srclib\ive_sas_windows"
882 sasautos = (c:\mymacros
883 !C:\Program Files\Srclib
884 !c:\documents and settings\rose marie)
885
886 mautosource;
887
888 LIBNAME MYLIB "C:\PROGRAM FILES\SRCLIB\COMBINED.DAT";
NOTE: Library MYLIB does not exist.
889 PROC COPY IN=MYLIB OUT=WORK;
WARNING: The Base Product product with which COPY is associated will expire within 30 days. Please contact your SAS installation representative to have it
renewed.
890
891 libname MYLIB 'C:\MYINDIR';
NOTE: Libref MYLIB was successfully assigned as follows:
Engine: V9
Physical Name: C:\MYINDIR
892
893 LIBNAME MYOUT 'C:\MYOUTDIR';
NOTE: Libref MYOUT was successfully assigned as follows:
Engine: V9
Physical Name: C:\MYOUTDIR
894

NOTE: Copying MYLIB.COMBINED to WORK.COMBINED (memtype=DATA).
NOTE: There were 63213 observations read from the data set MYLIB.COMBINED.
NOTE: The data set WORK.COMBINED has 63213 observations and 42 variables.
NOTE: PROCEDURE COPY used (Total process time):
real time 1.01 seconds
cpu time 0.04 seconds


895 DATA _NULL_;
WARNING: The Base Product product with which DATASTEP is associated will expire within 30 days. Please contact your SAS installation representative to have it
renewed.
896 INFILE DATALINES;
897 FILENAME MYSETUP "IMPUTE SET";
898 FILE MYSETUP;
899 INPUT;
900 PUT _INFILE_;
901 DATALINES4;

NOTE: The file MYSETUP is:
File Name=C:\Documents and Settings\Rose Marie\IMPUTE SET,
RECFM=V,LRECL=256

NOTE: 20 records were written to the file MYSETUP.
The minimum record length was 80.
The maximum record length was 80.
NOTE: DATA statement used (Total process time):
real time 0.29 seconds
cpu time 0.01 seconds


922 ;;;;
923
924 libname MYLIB 'C:\MYINDIR';
NOTE: Libref MYLIB was successfully assigned as follows:
Engine: V9
Physical Name: C:\MYINDIR
925 LIBNAME MYOUT 'C:\MYOUTDIR';
NOTE: Libref MYOUT was successfully assigned as follows:
Engine: V9
Physical Name: C:\MYOUTDIR
WARNING: Apparent invocation of macro IMPUTE not resolved.
926
927
928 %IMPUTE (NAME=MYSETUP,DIR=C:\MYOUTDIR, SETUP=NEW);
-
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

929
930 TITLE MULTIPLE IMPUTATION;
931
932 DATAIN MYLIB.COMBINED;
------
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

933 DATAOUT MYOUT.IMPUTED1;
-------
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

934 MDATA IMPUTE;
-----
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

935
936 CONTINUOUS YEARCAN MONCAN YEARHIV MONHIV YEARAIDS MONAIDS
----------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.

937 AGEHIV AGECAN AGEAIDS DEATHMM YEARDEC;

938 CATEGORICAL GENDER RACE DEC;
-----------
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

939 TRANSFER MATCH CASE ID DEATHDD DAYCAN DAYHIV DAYAIDS TUMORGR
--------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.

940 ICDO PRIMSITE MORPHOL SSTAGE RADIAD SURGERY CHEMO CD4 DAYSHAC
941 DAYSHAA CAGECAN CAGEAIDS ICDBEH AIDSCASE YRMOCAN YRMOHIV ETHNIC;

942 RESTRICT AGECAN (YEARCAN NE " ")
--------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.

943 AGEAIDS (YEARAIDS NE " ");

944
945
946 ITERATIONS 10;
----------
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

947 MULTIPLES 5;
---------
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

948 SEED 100;
----
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro PUTDATA not resolved.
949 RUN ;
950
951
952 %PUTDATA(NAME=MYSETUP,DIR=C:\MYOUTDIR,MULT=2,DATAOUT=MYOUT.IMPUTED2);
-
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro PUTDATA not resolved.
953 %PUTDATA(NAME=MYSETUP,DIR=C:\MYOUTDIR,MULT=3,DATAOUT=MYOUT.IMPUTED2);
-
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro PUTDATA not resolved.
954 %PUTDATA(NAME=MYSETUP,DIR=C:\MYOUTDIR,MULT=4,DATAOUT=MYOUT.IMPUTED2);
-
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro PUTDATA not resolved.
955 %PUTDATA(NAME=MYSETUP,DIR=C:\MYOUTDIR,MULT=5,DATAOUT=MYOUT.IMPUTED2);
-
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

WARNING: Apparent invocation of macro DESCRIBE not resolved.
956
957
958
959 %DESCRIBE (SETUP=NEW,NAME=DISETUP,DIR=C:\MYOUTDIR);
-
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

960 DATAIN MYOUT.IMPUTED1
------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.

961 MYOUT.IMPUTED2
962 MYOUT.IMPUTED3
963 MYOUT.IMPUTED4
964 MYOUT.IMPUTED5;

965 PRINT DETAILS;
-----
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

966 RUN;
Super Contributor
Super Contributor
Posts: 3,174

Re: Use of Macros under IVEware

You still have not resolved the OPTIONS SASAUTOS= and as recommended used a FILENAME declaration for the location of your IVEware macros. The OPTIONS SET= will sent an environment variable but for what purpose? Do you expect to reference it in your SASAUTOS= OPTIONS definition? It's unclear where you received guidance for this coding technique at all, frankly.

As a typical technique to reference your application's SAS AUTOCALL macros, you declare a SAS FILENAME with a specified and the folder/directory location in quotations, as mentioned before.

Suggest you refer to the FILENAME documentation and also the OPTIONS SASAUTOS=(...) definition. Here is a Google advanced search argument which should generate some matches for you to reference:

macro language using autocall site:sas.com

Until you get your SASAUTOS= setting defined correctly to point to the location where you have your IVEware SAS application programs installed, you will not be able to run your program.

Scott Barry
SBBWorks, Inc.


Scott Barry
SBBWorks, Inc.
Super Contributor
Super Contributor
Posts: 3,174

Re: Use of Macros under IVEware

You still have not resolved the OPTIONS SASAUTOS= and as recommended used a FILENAME declaration for the location of your IVEware macros. The OPTIONS SET= will sent an environment variable but for what purpose? Do you expect to reference it in your SASAUTOS= OPTIONS definition? It's unclear where you received guidance for this coding technique at all, frankly.

As a typical technique to reference your application's SAS AUTOCALL macros, you declare a SAS FILENAME with a specified and the folder/directory location in quotations, as mentioned before.

Suggest you refer to the FILENAME documentation and also the OPTIONS SASAUTOS=(...) definition. Here is a Google advanced search argument which should generate some matches for you to reference:

macro language using autocall site:sas.com

Until you get your SASAUTOS= setting defined correctly to point to the location where you have your IVEware SAS application programs installed, you will not be able to run your program.

Scott Barry
SBBWorks, Inc.


Scott Barry
SBBWorks, Inc.
SAS Employee
Posts: 58

Re: Use of Macros under IVEware

Make sure you have the mautosource option set (it should be by default unless it was previously turned off during your SAS session).

options mautosource;

If your macros are compiled stored macros you also need the mstored option.

Then, as was previously mentioned, make sure your sasautos= option is correct. You can either set this to a previously defined fileref or you can use a system path but the system path must be in quotes.

Each macro needs to be stored in a separate file with a name that matches the macro name, e.g. impute.sas

--Pat
New Contributor
Posts: 3

Re: Use of Macros under IVEware

I am way late to the party here. I will add this, in case it helps anyone else.

Did you run the program in Program Editor, as opposed to the Enhanced Program Editor? You must run it in the first, not the second.

Also, i have had more luck editing the config file instead of running the options command each time.

from IVEware Installation Guide, SAS version

Edit the configuration file to include the following lines in the user section, just above the warning "Install application edits below this line. User options should be added above this box comment."

-set SRCLIB "C:\Program Files\Srclib"
-sasautos (!SRCLIB sasautos)

Ask a Question
Discussion stats
  • 6 replies
  • 510 views
  • 0 likes
  • 4 in conversation