Hello
I want to build dataset from format(put the formats values from proc format into a data set).
This is the error I get
38 proc format cntlout= FormatDef(keep= Start rename=(Start = Category));
39 select $AgePratiVF.;
____________
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, $, @.
ERROR 200-322: The symbol is not recognized and will be ignored.
proc format;
value $AgeFmt
Other ='(a) Null'
'less 25'='(b) less 25'
'26-31'='(c) 26-31'
'32-42'='(d) 32-42'
'43-67'='(e) 43-67'
'more 67'='(f) more 67'
'All Other'='(g) All Other'
;
Run;
proc format cntlout= FormatDef(keep= Start rename=(Start = Category));
select $AgeFmt.;
run;
@Ronein wrote:
Hello
I want to build dataset from format(put the formats values from proc format into a data set).
This is the error I get
38 proc format cntlout= FormatDef(keep= Start rename=(Start = Category));
39 select $AgePratiVF.;
____________
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, $, @.ERROR 200-322: The symbol is not recognized and will be ignored.
Please format your logs properly, so we can know what part of the code is actually underlined. You do this by pasting the log into the window that appears when you click on the </> icon. I am dismayed that after you have been in the SAS Communities for years now, you aren't doing this automatically.
37 proc format cntlout= FormatDef(keep= Start rename=(Start = Category)); 2 The SAS System 14:12 Monday, October 11, 2021 38 select $AgeFmt.; ________ 22 200 ERROR 22-322: Syntax error, expecting one of the following: a name, $, @. ERROR 200-322: The symbol is not recognized and will be ignored. NOTE: The previous statement has been deleted. 39 run; NOTE: PROCEDURE FORMAT used (Total process time): real time 0.01 seconds user cpu time 0.00 seconds system cpu time 0.01 seconds memory 360.50k OS Memory 18592.00k Timestamp 10/11/2021 02:12:54 PM Step Count 3 Switch Count 1 Page Faults 0 Page Reclaims 92 Page Swaps 0 Voluntary Context Switches 41 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 0 NOTE: Compression was disabled for data set WORK.FORMATDEF because compression overhead would increase the size of the data set. NOTE: No formats found that match SELECT statement. NOTE: The data set WORK.FORMATDEF has 0 observations and 1 variables. NOTE: The SAS System stopped processing this step because of errors. 40 41 GOPTIONS NOACCESSIBLE; 42 %LET _CLIENTTASKLABEL=; 43 %LET _CLIENTPROCESSFLOWNAME=; 44 %LET _CLIENTPROJECTPATH=; 45 %LET _CLIENTPROJECTPATHHOST=; 46 %LET _CLIENTPROJECTNAME=; 47 %LET _SASPROGRAMFILE=; 48 %LET _SASPROGRAMFILEHOST=; 49 50 ;*';*";*/;quit;run; 51 ODS _ALL_ CLOSE; 52 53 54 QUIT; RUN; 55
Since I didn't design or create the SAS language ... I can only guess.
In a DATA step, you have to indicate somehow that you are referring to a format and not a variable name, the dot tells SAS you mean a format and no dot tells SAS you mean a variable name. In PROC FORMAT, the SELECT statement only can refer to formats, not variable names, so not dot needed (and in fact a dot is wrong).
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.