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

Hi All,

 

I am getting an error when I try to format several results to comma9.

 

 Format Total_FY_Answered_Calls Comma9.;
                                           _______
                                           484
NOTE 484-185: Format $COMMA was not found or could not be loaded.

 

I'm not sure if the Prompts I have used are affecting the end result - they are set to

  • Prompt Type: Numeric
  • Allow only integer values

Prompt.png

 

Data work.ASA_Forecast_Part_Calc_1;
	Set Work.ASA_Forecast_Part_sum;
	Additional_Calls = "&Total_Calls_1" - Calls_Answered_cnt;
	Total_FY_Answered_Calls = "&Total_Calls_1" ;
	Total_Add_TM = Additional_Calls * "&Total_Calls_1_ASA";
	Required_ASA = "&Total_Calls_1_ASA";
	ASA = (Total_Add_TM + TOTAL_ANSWER_TM) / Total_FY_Answered_Calls;

	Format Total_FY_Answered_Calls Comma9.;



RUN;

The current output looks like this

 

Output.JPG

This is what I woukl like the numeric figures to be formatted as

Required_Output.JPG

 

Any help is appreciated.

 

Cheers

 

Dean


Required_Output.JPG
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Did you notice the $ in the error message?  SAS has kindly tried to fix your attempt to attach the numeric format COMMA to the character variable Total_FY_Answered_Calls by looking for the character format $COMMA instead.  But it did not find any $COMMA format.

Assuming that your macro variables contain strings that look like numbers you should be able to fix this by just removing the quotes.

 

Additional_Calls = &Total_Calls_1 - Calls_Answered_cnt;
Total_FY_Answered_Calls = &Total_Calls_1 ;
Total_Add_TM = Additional_Calls * &Total_Calls_1_ASA;
Required_ASA = &Total_Calls_1_ASA;
ASA = (Total_Add_TM + TOTAL_ANSWER_TM) / Total_FY_Answered_Calls;
Format Total_FY_Answered_Calls Comma9.;

 

View solution in original post

7 REPLIES 7
Ksharp
Super User
If I was right , variable Total_FY_Answered_Calls  is character type.
Check it by
 proc contents data=have; run;

DME790
Pyrite | Level 9

 

Thanks Ksharp - I thought that was the case - Now for the silly question how do I change them to be numeric?

 

I will need to convert to numeric the following

 

  1. Total_FY_Answered_Calls
  2. Required_ASA

 

Thanks for your help in advance

 

format.JPG

 

Ksharp
Super User
use INPUT() then format it.

new=input(Total_FY_Answered_Calls , best32.);
format new comma.;




DME790
Pyrite | Level 9

Thanks KSharp,

 

Tom's advice worked for me but will keep your code for future reference to help format output.

 

Cheers

 

Dean

Tom
Super User Tom
Super User

Did you notice the $ in the error message?  SAS has kindly tried to fix your attempt to attach the numeric format COMMA to the character variable Total_FY_Answered_Calls by looking for the character format $COMMA instead.  But it did not find any $COMMA format.

Assuming that your macro variables contain strings that look like numbers you should be able to fix this by just removing the quotes.

 

Additional_Calls = &Total_Calls_1 - Calls_Answered_cnt;
Total_FY_Answered_Calls = &Total_Calls_1 ;
Total_Add_TM = Additional_Calls * &Total_Calls_1_ASA;
Required_ASA = &Total_Calls_1_ASA;
ASA = (Total_Add_TM + TOTAL_ANSWER_TM) / Total_FY_Answered_Calls;
Format Total_FY_Answered_Calls Comma9.;

 

DME790
Pyrite | Level 9

Thanks Tom,

 

That has done it for me - so simple when you know how.

 

Just to clarify as I have only used prompts for dates -

You use the quote marks if it is a date or text otherwise if the input is numeric leave the quotes out?

 

Cheers

 

Dean

 

Tom
Super User Tom
Super User

Probably has more to do with how you are using the macro variables in the code than with the prompts themselves.

If you want to create a string literal then you need to have the value in quotes.  

name = 'Sally';
address = "123 West Front Street";

If the value of the string literal is coming from a macro variable then the quotes need to be double quote characters, otherwise the & trigger is treated as a normal character.

company = 'Ben&Jerry' ;
ceo = "&my_prompt_value" ;

SAS also support date literals (and other special literals) in a similar way.  In particular date literals use a quoted string follwed immediately by the letter D.  The string needs to be in DATE. format (ie ddMMMyy , dd-MMM-yyyy).

%let due_date_prompt = 15APR2017 ;
....
 days_left = "&due_date_prompt"d - date() ;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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