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

Hello,

 

I would like to default a format of comma20. for values in a proc report but I keep getting the error "expecting one of the following: a name, a format name..." 

 

Here is my code:

proc report data=one;
columns [some columns];
format default=comma20. sales=dollar30.2;
run;

The table contains character and numeric data.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Is default a variable?

 

A format statement has a different syntax:

 

format VariableName format. ;

No equal sign and default doesn't apply to anything. 

 

If you want to apply it to all numeric variables you can use the following, but not sure how that would handle the SALES variable.

 

format _numeric_ comma20.;

View solution in original post

4 REPLIES 4
ballardw
Super User

The general form of a format statement is

format variablename formatname. ;

no = used.

 

You might try:

format _numeric_ comma20. ;

_numeric_ is a special list that includes all numeric variables.

I am not sure if that will work for computed variables though.

 

format sales dollar30.2; after should set the format for that variable as the last defined should prevail.

Reeza
Super User

Is default a variable?

 

A format statement has a different syntax:

 

format VariableName format. ;

No equal sign and default doesn't apply to anything. 

 

If you want to apply it to all numeric variables you can use the following, but not sure how that would handle the SALES variable.

 

format _numeric_ comma20.;
hulksmash
Obsidian | Level 7

This worked!  The documentation was not the best to point out the "Default=" was not the correct syntax

ballardw
Super User
You might have been confusing the procedure level Format= option in proc tabulate. You can on the Proc Tabulate statement have Format=comma20. and then that becomes the default for cells of the table(s) displayed. But again the syntax is different as no variable is mentioned.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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