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",
....
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
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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.