Good Day expect,
am running the below script and am getting the above error message
PROC SQL;
CREATE TABLE CAP.DECK16P4 AS
SELECT 'DECK16P4' AS DECK,*
FROM FB.FINAL_BRACC_ALL
WHERE ACCNRSER IN
(
SELECT INPUT(PUT(COMPRESS(INPUT(PUT(ACNO,13.),$13.)||PUT(SERIAL,Z3.)),$16.),16.)
FROM WORK.MAP_COP_FILE
);
quit;
lOG
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL='Program (16)';
4 %LET _CLIENTPROCESSFLOWNAME='Process Flow';
5 %LET _CLIENTPROJECTPATH='Y:\AML\VBM\SAP Model\SAS Scripts\SAS Scripts\Tracking Tool.egp';
6 %LET _CLIENTPROJECTPATHHOST='LSBSA-4HDVQ73';
7 %LET _CLIENTPROJECTNAME='Tracking Tool.egp';
8 %LET _SASPROGRAMFILE='';
9 %LET _SASPROGRAMFILEHOST='';
10
11 ODS _ALL_ CLOSE;
12 OPTIONS DEV=PNG;
13 GOPTIONS XPIXELS=0 YPIXELS=0;
14 FILENAME EGSR TEMP;
15 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
16 STYLE=HtmlBlue
17 STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css")
18 NOGTITLE
19 NOGFOOTNOTE
20 GPATH=&sasworklocation
21 ENCODING=UTF8
22 options(rolap="on")
23 ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24
25 GOPTIONS ACCESSIBLE;
26
27 PROC SQL;
28 CREATE TABLE CAP.DECK16P4 AS
29 SELECT 'DECK16P4' AS DECK,*
30
31 FROM FB.FINAL_BRACC_ALL
32 WHERE ACCNRSER IN
33 (
34 SELECT INPUT(PUT(COMPRESS(INPUT(PUT(ACNO,13.),$13.)||PUT(SERIAL,Z3.)),$16.),16.)
35 FROM WORK.MAP_COP_FILE
36 );
ERROR: Numeric format F in PUT function requires a numeric argument.
ERROR: Numeric format Z in PUT function requires a numeric argument.
ERROR: Numeric format F in PUT function requires a numeric argument.
ERROR: Numeric format Z in PUT function requires a numeric argument.
NOTE: MVA_DSIO.OPEN_CLOSE| _DISARM| STOP| _DISARM| 2022-04-20T14:32:23,969+02:00| _DISARM| WorkspaceServer| _DISARM| SAS|
_DISARM| | _DISARM| 2206438| _DISARM| 27697152| _DISARM| 13| _DISARM| 21| _DISARM| 0| _DISARM| 56| _DISARM| 0.000000|
_DISARM| 0.025944| _DISARM| 1966077143.943687| _DISARM| 1966077143.969631| _DISARM| 0.000000| _DISARM| | _ENDDISARM
NOTE: MVA_DSIO.OPEN_CLOSE| _DISARM| STOP| _DISARM| 2022-04-20T14:32:23,969+02:00| _DISARM| WorkspaceServer| _DISARM| SAS|
_DISARM| | _DISARM| 624679| _DISARM| 27697152| _DISARM| 13| _DISARM| 21| _DISARM| 0| _DISARM| 56| _DISARM| 0.010000| _DISARM|
0.001826| _DISARM| 1966077143.968149| _DISARM| 1966077143.969975| _DISARM| 0.010000| _DISARM| | _ENDDISARM
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
37 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE| _DISARM| STOP| _DISARM| 2022-04-20T14:32:23,970+02:00| _DISARM| WorkspaceServer| _DISARM| SAS| _DISARM| |
_DISARM| 118976512| _DISARM| 27697152| _DISARM| 13| _DISARM| 21| _DISARM| 0| _DISARM| 56| _DISARM| 0.010000| _DISARM|
0.084105| _DISARM| 1966077143.886494| _DISARM| 1966077143.970599| _DISARM| 0.010000| _DISARM| | _ENDDISARM
NOTE: PROCEDURE SQL used (Total process time):
real time 0.08 seconds
user cpu time 0.01 seconds
2 The SAS System 13:46 Wednesday, April 20, 2022
system cpu time 0.00 seconds
memory 6551.28k
OS Memory 32432.00k
Timestamp 2022/04/20 02:32:23 PM
Step Count 60 Switch Count 0
Page Faults 0
Page Reclaims 78
Page Swaps 0
Voluntary Context Switches 22
Involuntary Context Switches 10
Block Input Operations 0
Block Output Operations 0
38
39 GOPTIONS NOACCESSIBLE;
40 %LET _CLIENTTASKLABEL=;
41 %LET _CLIENTPROCESSFLOWNAME=;
42 %LET _CLIENTPROJECTPATH=;
43 %LET _CLIENTPROJECTPATHHOST=;
44 %LET _CLIENTPROJECTNAME=;
45 %LET _SASPROGRAMFILE=;
46 %LET _SASPROGRAMFILEHOST=;
47
48 ;*';*";*/;quit;run;
49 ODS _ALL_ CLOSE;
50
51
52 QUIT; RUN;
53
accno is a character and serial is a character
Variable Serial is not numeric.
Pretty plain: where you are using the Z format the variable is not numeric.
RROR: Numeric format Z in PUT function requires a numeric argument.
accno is a character and serial is a character
SAS is telling you that the format requires a numeric value.
So instead of
PUT(ACNO,13.)
just use
ACNO
and similarly for variable SERIAL
What are you trying to do with this?
INPUT(PUT(COMPRESS(INPUT(PUT(ACNO,13.),$13.)||PUT(SERIAL,Z3.)),$16.),16.)
This code is expecting ACNO and SERIAL to be NUMERIC variables.
The inner code is this:
COMPRESS(
INPUT(PUT(ACNO,13.),$13.)
|| PUT(SERIAL,Z3.)
)
It is converting ACNO to 13 character string using PUT(). Then reading just the first 13 characters (which is ALL of them) using the INPUT() function. It is converting SERIAL to a three character string that has leading zeros instead of the normal leading spaces. Then it removes all of the spaces it generated with the PUT() function call.
So this could be reduced to:
cats(ACNO,put(SERAL,Z3.))
Note that this will work the same if ACNO is numeric or character.
The outer the output PUT() does nothing. The INPUT() will convert the result to a number since it is using a numeric informat. Note that the INPUT() function does not care if the width used on the informat is larger than the length of the string to be read. So just use 32. as the informat.
PROC SQL;
CREATE TABLE CAP.DECK16P4 AS
SELECT 'DECK16P4' AS DECK,*
FROM FB.FINAL_BRACC_ALL
WHERE ACCNRSER IN
(SELECT input(cats(ACNO,put(SERAL,Z3.)),32.) FROM WORK.MAP_COP_FILE)
;
quit;
i ran this code however am still getting the same error message
ERROR: Numeric format Z in PUT function requires a numeric argument.
ERROR: Numeric format Z in PUT function requires a numeric argument.
@Rixile106 wrote:
i ran this code however am still getting the same error message
ERROR: Numeric format Z in PUT function requires a numeric argument.
ERROR: Numeric format Z in PUT function requires a numeric argument.
Show us the full log for this PROC SQL, every single line in the log for this PROC SQL, every single character in the log for this PROC SQL, leaving nothing out. (Do this from now on whenever you get an ERROR in the log). Copy the entire log for this PROC SQL as text, paste it into the window that appears when you click on the </> icon, do not skip this step.
The SAS System 13:46 Wednesday, April 20, 2022 1 ;*';*";*/;quit;run; 2 OPTIONS PAGENO=MIN; 3 %LET _CLIENTTASKLABEL='Program (16)'; 4 %LET _CLIENTPROCESSFLOWNAME='Process Flow'; 5 %LET _CLIENTPROJECTPATH='Y:\AML\VBM\SAP Model\SAS Scripts\SAS Scripts\Tracking Tool.egp'; 6 %LET _CLIENTPROJECTPATHHOST='LSBSA-4HDVQ73'; 7 %LET _CLIENTPROJECTNAME='Tracking Tool.egp'; 8 %LET _SASPROGRAMFILE=''; 9 %LET _SASPROGRAMFILEHOST=''; 10 11 ODS _ALL_ CLOSE; 12 OPTIONS DEV=PNG; 13 GOPTIONS XPIXELS=0 YPIXELS=0; 14 FILENAME EGSR TEMP; 15 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR 16 STYLE=HtmlBlue 17 STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HtmlBlue.css") 18 NOGTITLE 19 NOGFOOTNOTE 20 GPATH=&sasworklocation 21 ENCODING=UTF8 22 options(rolap="on") 23 ; NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR 24 25 GOPTIONS ACCESSIBLE; 26 PROC SQL; 27 CREATE TABLE CAP.DECK16P4 AS 28 SELECT 'DECK16P4' AS DECK,* 29 FROM FB.FINAL_BRACC_ALL 30 WHERE ACCNRSER IN 31 (SELECT input(cats(ACNO,put(SERIAL,Z3.)),32.) FROM WORK.MAP_COP_FILE) 32 ; ERROR: Numeric format Z in PUT function requires a numeric argument. ERROR: Numeric format Z in PUT function requires a numeric argument. NOTE: MVA_DSIO.OPEN_CLOSE| _DISARM| STOP| _DISARM| 2022-04-20T16:04:25,633+02:00| _DISARM| WorkspaceServer| _DISARM| SAS| _DISARM| | _DISARM| 2206438| _DISARM| 28872704| _DISARM| 13| _DISARM| 21| _DISARM| 0| _DISARM| 56| _DISARM| 0.000000| _DISARM| 0.007012| _DISARM| 1966082665.626271| _DISARM| 1966082665.633283| _DISARM| 0.000000| _DISARM| | _ENDDISARM NOTE: MVA_DSIO.OPEN_CLOSE| _DISARM| STOP| _DISARM| 2022-04-20T16:04:25,633+02:00| _DISARM| WorkspaceServer| _DISARM| SAS| _DISARM| | _DISARM| 624679| _DISARM| 28872704| _DISARM| 13| _DISARM| 21| _DISARM| 0| _DISARM| 56| _DISARM| 0.000000| _DISARM| 0.001593| _DISARM| 1966082665.631943| _DISARM| 1966082665.633536| _DISARM| 0.000000| _DISARM| | _ENDDISARM NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements. 33 quit 34 35 GOPTIONS NOACCESSIBLE; NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE| _DISARM| STOP| _DISARM| 2022-04-20T16:04:25,634+02:00| _DISARM| WorkspaceServer| _DISARM| SAS| _DISARM| | _DISARM| 119238656| _DISARM| 28872704| _DISARM| 13| _DISARM| 21| _DISARM| 0| _DISARM| 56| _DISARM| 0.010000| _DISARM| 0.017875| _DISARM| 1966082665.616178| _DISARM| 1966082665.634053| _DISARM| 0.010000| _DISARM| | _ENDDISARM NOTE: PROCEDURE SQL used (Total process time): real time 0.01 seconds user cpu time 0.01 seconds system cpu time 0.00 seconds memory 6549.68k OS Memory 33580.00k Timestamp 2022/04/20 04:04:25 PM Step Count 86 Switch Count 0 Page Faults 0 2 The SAS System 13:46 Wednesday, April 20, 2022 Page Reclaims 153 Page Swaps 0 Voluntary Context Switches 20 Involuntary Context Switches 12 Block Input Operations 0 Block Output Operations 0 36 %LET _CLIENTTASKLABEL=; 37 %LET _CLIENTPROCESSFLOWNAME=; 38 %LET _CLIENTPROJECTPATH=; 39 %LET _CLIENTPROJECTPATHHOST=; 40 %LET _CLIENTPROJECTNAME=; 41 %LET _SASPROGRAMFILE=; 42 %LET _SASPROGRAMFILEHOST=; 43 44 ;*';*";*/;quit;run; 45 ODS _ALL_ CLOSE; 46 47 48 QUIT; RUN; 49
Variable Serial is not numeric.
Pretty plain: where you are using the Z format the variable is not numeric.
RROR: Numeric format Z in PUT function requires a numeric argument.
If you want code that does not care if the variables are numeric or character then use something like:
input(cats(ACNO),32.)*1000 + input(cats(SERIAL),32.)
Of course if the variables are character strings the character would need to represent valid integers for it to work.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: