BookmarkSubscribeRSS Feed
ranikeka
Calcite | Level 5
Hi

I am using proc sql method for percentage calculation to generate table. First column group A and second column with group B and third column with total of A and B. The following error comes up could you please help how to solve this issue.


Proc sql;
Create table bytra as select
100*round(pt1/ys,0.01) as bytrapct,
100*round(pt2/ys,0.01) as bytrapct,
100*round(pt1/123, 0.01) as bytrapct,

From file1;
Quit;

Invalid or missing arguments to the round function have caused the function to return a missing value.

Many thanks for all the help.

5 REPLIES 5
yabwon
Onyx | Level 15

Please share some exemplary data so we can test your code.  

 

Btw. the message says you have missing values in your data.

 

All the best

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



ranikeka
Calcite | Level 5
Thank you 🙏
Kurt_Bremser
Super User

@ranikeka wrote:
Hi

I am using proc sql method for percentage calculation to generate table. First column group A and second column with group B and third column with total of A and B. The following error comes up could you please help how to solve this issue.


Proc sql;
Create table bytra as select
100*round(pt1/ys,0.01) as bytrapct,
100*round(pt2/ys,0.01) as bytrapct,
100*round(pt1/123, 0.01) as bytrapct,

From file1;
Quit;

Invalid or missing arguments to the round function have caused the function to return a missing value.

Many thanks for all the help.


Your code as posted will cause a syntax ERROR because of a surplus comma, and once that is corrected, it will cause a WARNING because you try to create the same variable three times.

The NOTE about missing values is caused by your data.

 

Sajid01
Meteorite | Level 14

Try this

 

Proc sql;
Create table bytra as

select
100*round(pt1/ys,0.01) as bytrapct1,
100*round(pt2/ys,0.01) as bytrapct2,
100*round(pt1/123, 0.01) as bytrapct3 /* I removed the comma here */

From file_1;


Quit;

ranikeka
Calcite | Level 5
Thanks 🙏

SAS Innovate 2025: Save the 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!

Save the date!

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
  • 5 replies
  • 880 views
  • 1 like
  • 4 in conversation