BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
acordes
Rhodochrosite | Level 12

I'd like to convert this program to a cas action like freqtab. Can I use the _numeric_ shortcut in an cas action?

Have:

proc format;
value $ missfmt ' '="Missing" other="Not Missing";
value nmissfmt .="Missing" other="Not Missing";
run;
*Proc freq to count missing/non missing;
options casdatalimit=all;
ods table onewayfreqs=temp;
proc freq data=MKT.PROFILE_PORTFOLIO;
table _all_ / missing;
format _numeric_ nmissfmt. _character_ $missfmt.;
run;

Want: 

proc cas;
   action freqTab.freqTab /
      table={name='PROFILE_PORTFOLIO', caslib="mkt", 
....
1 ACCEPTED SOLUTION

Accepted Solutions
JOL
SAS Employee JOL
SAS Employee

No, it does not appear possible to use special name lists and the documentation does not seem to support it. 

Some tips:

Add user-defined formats to CAS with the CASFMTLIB option:

proc format CASFMTLIB = "CASFORMATS";
value $ missfmt ' '="Missing" other="Not Missing";
value nmissfmt .="Missing" other="Not Missing";
run;

   

 

Apply formats with the ALTERTABLE action:

proc cas;
table.altertable / columns{{name = "Var1", format = "$missfmt."
                            {name = "Var2", format = "nmissfmt."}},
      name='PROFILE_PORTFOLIO';
action freqTab.freqTab /
    table={name='PROFILE_PORTFOLIO', caslib="mkt", ...

 

 

Documentation:

Manage Your User-Defined Formats

Applying Labels and Formats

 

 

 

 

 

 

View solution in original post

1 REPLY 1
JOL
SAS Employee JOL
SAS Employee

No, it does not appear possible to use special name lists and the documentation does not seem to support it. 

Some tips:

Add user-defined formats to CAS with the CASFMTLIB option:

proc format CASFMTLIB = "CASFORMATS";
value $ missfmt ' '="Missing" other="Not Missing";
value nmissfmt .="Missing" other="Not Missing";
run;

   

 

Apply formats with the ALTERTABLE action:

proc cas;
table.altertable / columns{{name = "Var1", format = "$missfmt."
                            {name = "Var2", format = "nmissfmt."}},
      name='PROFILE_PORTFOLIO';
action freqTab.freqTab /
    table={name='PROFILE_PORTFOLIO', caslib="mkt", ...

 

 

Documentation:

Manage Your User-Defined Formats

Applying Labels and Formats

 

 

 

 

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 1 reply
  • 952 views
  • 0 likes
  • 2 in conversation