pcpNPI is a numeric 20 variable but i'm getting an error for some reason:
454 proc sql;
455 create table ppp
456 as select
457 a.pid,
458 a.input(pcpNPI, 20.) format=20. as pcpNPI2,
_ __
79 22
76
ERROR 79-322: Expecting a FROM.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, (, CONNECTION, DICTIONARY.
ERROR 76-322: Syntax error, statement will be ignored.
459 a.pname,
460 a.group,
461 b.nflg,
462 b.dflg,
463 b.cond,
464 b.days
465 from ftable as A
466 inner join numerator1 as B
467 on a.pid=b.pid
468 where pcpNPI2 in ('444', '444','444','444','444','444',
469 '44','44','44','444','444');
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
470 run;
If variable pcpNPI is numeric, then you would not use INPUT here. You may want to use PUT, or just eliminate the function entirely and use
a.pcpNPI format=20. as pcpNPI2
How about this:
input(a.pcpNPI, 20.) format=20. as pcpNPI2,
I did what you requested but still getting an error:
proc sql;
24 create table pp
25 as select
26 a.pid,
27 input(a.pcpNPI, 20.) format=20. as pcpNPI2,
ERROR: INPUT function requires a character argument.
ERROR: Character expression requires a character format.
ERROR: INPUT function requires a character argument.
ERROR: Character expression requires a character format.
ERROR: The following columns were not found in the contributing tables: pcpNPI2.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
44 run;
If variable pcpNPI is numeric, then you would not use INPUT here. You may want to use PUT, or just eliminate the function entirely and use
a.pcpNPI format=20. as pcpNPI2
@bhca60 wrote:
Its actually Numeric with len 8 and format 20.
What types of values does it hold? SAS cannot store 20 digit numbers exactly.
If this is some type of identifier then you should switch it to character, but you would need to do that BEFORE if becomes a number in SAS. So if you are reading it from a text file, like a CSV file, then read it as character to start with. If it is coming from an external database (like ORACLE) then convert it to a character string in that database before puling it into a SAS dataset.
If it is actually a number then just realize that it will not be accurate to all 20 decimal places. That should not matter for most things.
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.