BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
braam
Quartz | Level 8

Is there a way to open my existing sas code files by executing a line of sas code? 

 

I mean, I would like to open three sas code files, let's say code1.sas, code2.sas, and code3.sas. Can I let my sas to open all of them? I know I can open them by dragging to sas or using menu. But I would like to do so via code. Thanks!

1 ACCEPTED SOLUTION
9 REPLIES 9
maguiremq
SAS Super FREQ

Use %include.

%include "path-to-program\code1.sas";

 

braam
Quartz | Level 8

Thanks for your comment. I know %include statement, but doesn't it run my code indicated by %include statement, rather than opening it in SAS window? Sorry for not making my question clearer, but I would like to have a code to open my other SAS codes in SAS window so that I can amend them if needed.

Tom
Super User Tom
Super User

@braam wrote:

Thanks for your comment. I know %include statement, but doesn't it run my code indicated by %include statement, rather than opening it in SAS window? Sorry for not making my question clearer, but I would like to have a code to open my other SAS codes in SAS window so that I can amend them if needed.


Assuming you are running SAS using the Display Manager interface then you want to execute the INCLUDE command line statement instead of the %INCLUDE macro statement. You can use the DM command to run Display Manager commands from code.  There are other commands for moving focus to the appropriate window, it doesn't work try to INCLUDE a file into the LOG or OUTPUT window.

Kurt_Bremser
Super User

This is NOT the %include macro statement. It is a command for the Display Manager to load the named file into the program editor.

The necessary commands may look different when using Windows Base SAS, as you can open several Enhanced Editor windows there IIRC.

The command I gave you was tested with Base SAS on AIX.

Tom
Super User Tom
Super User

Open to do what? Open with what?

braam
Quartz | Level 8

I would like to have a code to open my other SAS code files in SAS window. Then I can look at my code files (interactively) and amend them if needed. Without this, how I do is to open several files manually whenever I turn on my PC and SAS. Hope that it's clearer.

Tom
Super User Tom
Super User

Seems like a strange request.  How do you know what programs you want to open for this SAS session?

 

You can open many "enhanced" editor windows in PC SAS.  You can only have one regular PGM window (on any operating system).

You can also open many NOTEPAD windows, which work a lot like editor windows, but you need to link some SAS catalog source object type.

 

Here is a good thread about how to find a list of SAS Display Manager commands.

https://stackoverflow.com/questions/1233056/sas-display-manager-commands

braam
Quartz | Level 8

Thank you so much for your help. Your code worked for me when "wpgm" is used in dm!

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
  • 9 replies
  • 4585 views
  • 3 likes
  • 4 in conversation