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
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
This is what I woukl like the numeric figures to be formatted as
Any help is appreciated.
Cheers
Dean
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.;
If I was right , variable Total_FY_Answered_Calls is character type. Check it by proc contents data=have; run;
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
Thanks for your help in advance
use INPUT() then format it. new=input(Total_FY_Answered_Calls , best32.); format new comma.;
Thanks KSharp,
Tom's advice worked for me but will keep your code for future reference to help format output.
Cheers
Dean
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.;
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
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 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.