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

Hi, I used commax format to format some numeric variables. Nevertheless, running the code I got an error: "character expression requires character format"

 

proc sql;
	create table 
	table
	as select 
		variable1,
		variable2   		format commax22.2
	from source;
quit;

I'm sure variable 2 is numeric, why do I get the error? thanks anyone for help

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

@ari2495 wrote:
Yes, i've just run, and i found out the format is "best". Can you suggest me what to do? thanks and excuse me, i'm a new user

Note the question is not what format is ATTACHED to the variable.  The question is what TYPE is the variable.

View solution in original post

4 REPLIES 4
ari2495
Obsidian | Level 7
Yes, i've just run, and i found out the format is "best". Can you suggest me what to do? thanks and excuse me, i'm a new user
Ksharp
Super User
format commax22.2
----->
format=commax22.2
Tom
Super User Tom
Super User

@ari2495 wrote:
Yes, i've just run, and i found out the format is "best". Can you suggest me what to do? thanks and excuse me, i'm a new user

Note the question is not what format is ATTACHED to the variable.  The question is what TYPE is the variable.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 533 views
  • 3 likes
  • 4 in conversation