SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
hartwell
Fluorite | Level 6

I'm just starting to work with SAS/CONNECT to parallelize some of our programming tasks.  I've work out how to pass a lot of things from the parent session to the subtasks (e.g. work library, macro variables, etc), but I can't find a way to pass locally-defined formats (meaning formats that are defined inside the parent code and are not stored anywhere).  Is there a way to do this or am I going to need to create a format library to store these local formats so they can be accessed?

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

@hartwell wrote:

I'm just starting to work with SAS/CONNECT to parallelize some of our programming tasks.  I've work out how to pass a lot of things from the parent session to the subtasks (e.g. work library, macro variables, etc), but I can't find a way to pass locally-defined formats (meaning formats that are defined inside the parent code and are not stored anywhere).  Is there a way to do this or am I going to need to create a format library to store these local formats so they can be accessed?


Formats have to be stored somewhere to be of any use.  Most likely you are asking how to access formats stored in WORK.FORMATS catalog.  

 

You could probably get it to work by doing two things.

1) Use the options in the connection syntax to have the WORK library visible in the remote session.

2) Since that will require that you reference them with a libref other than WORK you will also need to modify the FMTSEARCH option in the remote session so they will be found.

 

If you want to copy the compiled formats instead of just pointing to them then use PROC UPLOAD with INCAT and OUTCAT options.

proc upload incat=work.formats outcat=work.formats ;
run;

View solution in original post

3 REPLIES 3
Tom
Super User Tom
Super User

@hartwell wrote:

I'm just starting to work with SAS/CONNECT to parallelize some of our programming tasks.  I've work out how to pass a lot of things from the parent session to the subtasks (e.g. work library, macro variables, etc), but I can't find a way to pass locally-defined formats (meaning formats that are defined inside the parent code and are not stored anywhere).  Is there a way to do this or am I going to need to create a format library to store these local formats so they can be accessed?


Formats have to be stored somewhere to be of any use.  Most likely you are asking how to access formats stored in WORK.FORMATS catalog.  

 

You could probably get it to work by doing two things.

1) Use the options in the connection syntax to have the WORK library visible in the remote session.

2) Since that will require that you reference them with a libref other than WORK you will also need to modify the FMTSEARCH option in the remote session so they will be found.

 

If you want to copy the compiled formats instead of just pointing to them then use PROC UPLOAD with INCAT and OUTCAT options.

proc upload incat=work.formats outcat=work.formats ;
run;
hartwell
Fluorite | Level 6

Thank you!

SASKiwi
PROC Star

If you are going to be running a lot of parallel SAS tasks, then it would be useful to create a permanent SAS format library and just define it in each of your SAS sessions:

libname MyFmt '<Formal library folder>';
proc format library = MyFmt;
<format statements>
run;

options fmtsearch = (MyFmt WORK SASAUTOS);

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 984 views
  • 3 likes
  • 3 in conversation