BookmarkSubscribeRSS Feed
wang226
Calcite | Level 5

I want to call a sas program in a SAS/AF frame, I wrote down a program in SAS/AF:

Pushbutton1:                                                                                                                           

                                                                                                                                       

rc=filename(fname,'F:\w1.sas');                                                                                                        

                                                                                                                                       

rc=preview('include',fname);                                                                                                           

                                                                                                                                       

submit continue;                                                                                                                       

                                                                                                                                       

endsubmit;                                                                                                                             

                                                                                                                                       

return;

But there are some warning in log:

WARNING: [Line 3]  Converting numeric variable fname to character

WARNING: [Line 5]  Converting numeric variable fname to character

WARNING: [Line 5]  Variable rc is defined but not used

WARNING: [Line 5]  Variable fname is uninitialized

NOTE: Code generated for CHESHIDIAOYONG.FRAME. Code size=1010.

I am a beginner.........thanks

7 REPLIES 7
Tom
Super User Tom
Super User

I have only a little experience with SCL programming, but the error message seems to say you need to declare FNAME as character.

Also shouldn't you have same actual code in your submit block?

wang226
Calcite | Level 5

Thanks a lot. but it doesn't work yet after I declare it. the log like this:

NOTE: Compiling CHESHIDIAOYONG.FRAME (SASUSER.EXAMPLE.CHESHIDIAOYONG.SCL).

WARNING: [Line 7]  Variable fname is uninitialized

WARNING: [Line 7]  Variable rc is defined but not used

NOTE: Code generated for CHESHIDIAOYONG.FRAME. Code size=934.

Patrick
Opal | Level 21

I believe you either need to previously define variable fname ( fname='myfile'; ) or put quotes around fname [ rc=filename('fname','F:\w1.sas'); ]

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

wang226
Calcite | Level 5

thanks a lot. it works like this:

Pushbutton1:                                                                                                                           

                                                                                                                                       

submit;                                                                                                                                

                                                                                                                                       

fname='myfile';                                                                                                                        

                                                                                                                                       

rc=filename(fname,'F:\w1.sas');                                                                                                        

                                                                                                                                       

rc=preview('include',fname);                                                                                                           

                                                                                                                                       

submit continue;                                                                                                                       

                                                                                                                                       

endsubmit;                                                                                                                             

                                                                                                                                       

return;

Tom
Super User Tom
Super User

How is this different than just coding.

Pushbutton1:

submit;    

  %include 'F:\w1.sas';

endsubmit;                                                                          

return;

wang226
Calcite | Level 5

I am so confused...If I use such program:

Pushbutton1:

submit;

fname='myfile';

rc=filename(fname,'F:\w1.sas');

rc=preview('include',fname);

submit continue;

endsubmit;

return;

Some times it works, some times it doesn't work.

When I use such program:

Pushbutton1:

submit;

%include 'F:\w1.sas';

endsubmit;

return;

After I press Pushbutton1, the results not been shown, and the results will be shown after I closed the frame. What is wron?

If I want to know whether the 'w1.sas' was finished, what shoud I do?

Thanks a lot!

wang226
Calcite | Level 5

I'm so confused....when I run the programm after several days, it doesn't work! Who can tell me what's wrong????

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
  • 7 replies
  • 700 views
  • 6 likes
  • 3 in conversation