BookmarkSubscribeRSS Feed
Mina-sh
Fluorite | Level 6

Hello,

I'm pretty new to SAS and have a file to understand the whole procedure. I was trying to run the code to analyze the results but it starts with this:

RUNMODEL:

 

 METHOD  PRFILE  $ 20  RAFILE  $ 20  RRFILE  $ 20  FAFILE  $ 20

         FPFILE  $ 20  DEFILE  $ 20  REFILE  $ 20  CAFILE  $ 20

         ALFILE  $ 20  COMMENT $ 60  PCTRATE    6

         NUMWHSES  MAXRUN 4;

Also in some places is referred to these inputs like this:

SET &FAFILE

does anybody know what does this command do and why I cannot run that?

 

Thank you in advance,

Mina

 

8 REPLIES 8
ballardw
Super User

You may need to show more code as you showing parts of code. Some bits are common to more than one procedure but often have their own dependencies. You should have a Log that shows the code you submitted and would have error or possibly warning messages at to why something does not work. You can copy and paste the relavent log results into the entry box opened from the menu {i} above.

 

The Set statment usually is used in a data step and refers to one or more data sets to incorporate into the current step for processing. The &FAFILE refers to a macro variable that should contain the name of one or more existing data sets and possibly data set options.

 

If the macro varaible is blank you would get a message such as this:

188  data _null_;
189     set &fafile;
            -
            22
            200
WARNING: Apparent symbolic reference FAFILE not resolved.
ERROR: File USER.FAFILE.DATA does not exist.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ;, END,
              INDSNAME, KEY, KEYS, NOBS, OPEN, POINT, _DATA_, _LAST_, _NULL_.

ERROR 200-322: The symbol is not recognized and will be ignored.

190  run;

 

If the FAFILE references a libbrary you may get a message about the library name is not assigned. If the data set referenced doesn't exist you would get a file does not exist error.

If you run this snippet of code it should show the assigned text of the macro variable:

%put FAFILE resolves to: &FAFILE;

The value will appear in the log.

Cynthia_sas
SAS Super FREQ
Hi:
RUNMODEL: looks like the beginning of a named section or label in a program you would typically also see a LINK statement that would link to this section, as shown here:
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000201972.htm

see the program and the example of the CALCU section called in a LINK statement.

The rest of the code in that section almost looks like the rest of a LENGTH statement that declares the lengths for a group of variables.

Anytime you see & or % references in a program, those are indications that the program is using macro variable references (&macvar) or macro functions (%function) or macro programs (%macpgm). So in that context, someplace in your program you would either see a %LET statement that sets a value for FAFILE or you will see a CALL SYMPUT that might set a value for FAFILE. It is hard to say more without seeing more code.

As @ballardw pointed out, in order for you to run the program successfully, you have to know how the macro variable value gets set and the macro variable has to have a value before the program will run successfully.

cynthia
Mina-sh
Fluorite | Level 6

Thank you so much. Here is the problem, as you can see in the whole very beginning part of the program that I posted later, these kinds of macro variables are not introduced to the program before referring them... 

Mina-sh
Fluorite | Level 6

This is exactly how the file begins and I'm so clueless... 

 

LENGTH MAXTIME 8 DIR $8;

 

RUNMODEL:

 

 METHOD  PRFILE  $ 20  RAFILE  $ 20  RRFILE  $ 20  FAFILE  $ 20

         FPFILE  $ 20  DEFILE  $ 20  REFILE  $ 20  CAFILE  $ 20

         ALFILE  $ 20  COMMENT $ 60  PCTRATE    6

         NUMWHSES  MAXRUN 4;

 

 ENVLST = ENVLIST('L');

DATA LOGBASE LOGNEW ;

 SET &DIR.LOG_RUNS ;      

 

  OUTPUT LOGBASE ;

  IF _N_ = 1 THEN OUTPUT LOGNEW ;

RUN ;

 

 

The output in the log is as bellow. Not surprisingly, it shows error for everything!

1 LENGTH MAXTIME 8 DIR $8;
------
180

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

2
3 RUNMODEL:
4
5 METHOD PRFILE $ 20 RAFILE $ 20 RRFILE $ 20 FAFILE $ 20
------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.

6 FPFILE $ 20 DEFILE $ 20 REFILE $ 20 CAFILE $ 20
7 ALFILE $ 20 COMMENT $ 60 PCTRATE 6
8 NUMWHSES MAXRUN 4;

9
10 ENVLST = ENVLIST('L');
------
180

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

11 CMDLST = GETNITEML(ENVLST,'_CMDLIST_');
------
180

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

12 DIR = GETNITEMC(CMDLST,'LIBNAME');
---
180

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

13
14 MAXTIME = MAXRUN * 60;
-------
180

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

15
16 SUBMIT CONTINUE ;
------
180

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

 CMDLST = GETNITEML(ENVLST,'_CMDLIST_');

 DIR = GETNITEMC(CMDLST,'LIBNAME');

 

 MAXTIME = MAXRUN * 60;

 

 SUBMIT CONTINUE ;

SASKiwi
PROC Star

This looks like SCL (Screen Control Language) to me. Where are you trying to run this? If you are trying to run this like a "normal" SAS program I'm not surprised it is failing. Where did you get the code for this?

Mina-sh
Fluorite | Level 6

So where can I run the code? I need to understand the whole procedure and then make the modifications in some parts. That is why I am trying to run the whole code to analyze the current output as the first step.

ballardw
Super User

SAS has the ability for one program file to call the contents of another file. It may be that what you are seeing is one such file that is referenced by:

 

%include "<path>\name of your codefile.sas";

where path would be a system path like C:\folder\subfolder pointing to the location of the program file and "name of your codefile.sas" would be the name of the file you are attempting to figure out.

It is not real good practice to have parts of a file not starting with a proper boundary but it is possible that is what some in the past did.

Unfortunately since the path could refer any valid location from the standpoint of the calling program that calling program need not be stored with the subordinate. You may want to start opening any other program files you find and search for %include statements and see if something pops up that looks somewhat like the name of the file.

 

For future reference if you do any code like this it would be a very good idea to put a comment at the top to document what is going on. Possibly something like:

/* This program file is conditionally %included by a call from C:\path\otherfolder\ProcessControl.sas when

<describe condition> occurs in the main program */

Better is to include 1) who wrote it and 2) when and 3) more about the overall process such as what inherited macro variables represent.

SASKiwi
PROC Star

An SCL (actually SAS Component Language) program is normally run from a SAS/AF Application. Here is a link explaining just one of the statements in your program ENVLIST:

 

http://support.sas.com/documentation/cdl/en/sclref/67564/HTML/default/viewer.htm#p1dm2u2fhop2xjn113d...

 

Again, how are you running this program? SAS/AF applications can only be run within SAS Display Manager on a PC with a full SAS installation.

 

What is the context of this program? Has it been provided to you as part of a SAS/AF application or some other way?  

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 1285 views
  • 8 likes
  • 4 in conversation