BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bondtk
Quartz | Level 8

Hi

 

I am getting this error, please advise.

 

My code is:

 

proc sql;

create table tk.Summary_allcat as

select

app_type_flag as app_type , AppSystem , State , proposed_ccr as CCR , datestamp

, final_decision as f_decision , F_Medico , SI_Final , FranchiseFlag_F as f_chise_f

, drawn_down_flag as d-downflag

, capacity_refer as capacity ,

collatoral_refer as collatoral , policy_refer as policy , character_refer as character

, ast , bureau , collatoral , affordability as afford , fraud , general ,

internalconduct as int_conduct , purpose , borrower, forcerefer, expense, ac11

 

, db21, ra03 , db23 , ra01 , rb21 , rb91 , rb95 , rb96 , rc01 , rfxx

, re51, rg01 , rg18 , rg19 , rg15 , rg16, rg17 , ri01, ri02 , ri03 , ri04 ,

ri25, ri31, ri33 , ri45 , ri46 , rp03 , rp06 , rp07 , rp08 , rp10 , rp12 , avxx ,

count(*) as num_apps

,sum(case when final_decision = 'Approved' then 1 else 0 end) as num_appr ,

sum(AMOUNT) as amt_apps,

sum(case when final_decision = 'Approved' then AMOUNT else 0 end) as amt_appr ,

sum(capacity_refer) as Cap_R,

sum(collatoral_refer) as Coll_R,

sum(policy_refer) as Pol_R,

sum(character_refer) as Char_R

,sum(case when final_decision = 'Approved' and ast = 1 then 1 else 0 end) as AST_appr

,sum(case when final_decision = 'Approved' and bureau =1 then 1 else 0 end) as BUREU_appr

,sum(case when final_decision = 'Approved' and collatoral =1 then 1 else 0 end) as COLAT_appr

,sum(case when final_decision = 'Approved' and affordability =1 then 1 else 0 end) as AFORD_appr

,sum(case when final_decision = 'Approved' and fraud =1 then 1 else 0 end) as FRAUD_appr

,sum(case when final_decision = 'Approved' and general =1 then 1 else 0 end) as GEN_appr

,sum(case when final_decision = 'Approved' and internalconduct =1 then 1 else 0 end) as INCON_appr

,sum(case when final_decision = 'Approved' and purpose =1 then 1 else 0 end) as PUR_appr

,sum(case when final_decision = 'Approved' and borrower =1 then 1 else 0 end) as BOROW_appr

,sum(case when final_decision = 'Approved' and forcerefer =1 then 1 else 0 end) as F_FER_appr

,sum(case when final_decision = 'Approved' and expense =1 then 1 else 0 end) as EXPEN_appr

,sum(ast) as Total_AST

,sum(bureau) as T_BUREAU

, sum(collatoral) as T_COLLAT

, sum(affordability) as T_AFFORD

, sum(fraud) as T_FRAUD

, sum(general) as T_GENERAL

, sum(internalconduct) as T_I_CONDT

, sum(purpose) as T_PURPOSE

, sum(borrower) as T_BORROWER

, sum(forcerefer) as T_F_REFER

, sum(expense) as T_EXPENSE

 

 

from

 

tk.SBOS_final1

 

group by

 

app_type_flag , capacity_refer , collatoral_refer , policy_refer , character_refer,

ast, bureau , collatoral, affordability, fraud , general , internalconduct , purpose ,

borrower, forcerefer, expense, ac11, db21, ra03 , db23 , ra01 , rb21 , rb91 , rb95 ,

rb96 , rc01 , rfxx , re51, rg01 , rg18 , rg19 , rg15 , rg16, rg17 , ri01, ri02 , ri03

, ri04 , ri25, ri31, ri33 , ri45 , ri46 , rp03 , rp06 , rp07 , rp08 , rp10 , rp12

, avxx, datestamp, final_decision , F_Medico , SI_Final , FranchiseFlag_F ,

AppSystem, State, proposed_ccr, drawn_down_flag

 

;

quit;

 

 

************************************

log error:

 

GOPTIONS ACCESSIBLE;

 

15 proc sql;

16 create table tk.Summary_allcat as

17 select

18 app_type_flag as app_type , AppSystem , State , proposed_ccr as CCR , datestamp

19 , final_decision as f_decision , F_Medico , SI_Final , FranchiseFlag_F as f_chise_f

20 , drawn_down_flag as d-downflag

_

78

76

ERROR 78-322: Expecting a ','.

ERROR 76-322: Syntax error, statement will be ignored.

21 , capacity_refer as capacity ,

22 collatoral_refer as collatoral , policy_refer as policy , character_refer as character

23 , ast , bureau , collatoral , affordability as afford , fraud , general ,

24 internalconduct as int_conduct , purpose , borrower, forcerefer, expense, ac11

25 , db21, ra03 , db23 , ra01 , rb21 , rb91 , rb95 , rb96 , rc01 , rfxx

26 , re51, rg01 , rg18 , rg19 , rg15 , rg16, rg17 , ri01, ri02 , ri03 , ri04 ,

27 ri25, ri31, ri33 , ri45 , ri46 , rp03 , rp06 , rp07 , rp08 , rp10 , rp12 , avxx ,

28

29 count(*) as num_apps

30 ,sum(case when final_decision = 'Approved' then 1 else 0 end) as num_appr ,

31 sum(AMOUNT) as amt_apps,

32 sum(case when final_decision = 'Approved' then AMOUNT else 0 end) as amt_appr ,

33

34 sum(capacity_refer) as Cap_R,

35 sum(collatoral_refer) as Coll_R,

36 sum(policy_refer) as Pol_R,

37 sum(character_refer) as Char_R

38

39 ,sum(case when final_decision = 'Approved' and ast = 1 then 1 else 0 end) as AST_appr

40 ,sum(case when final_decision = 'Approved' and bureau =1 then 1 else 0 end) as BUREU_appr

41 ,sum(case when final_decision = 'Approved' and collatoral =1 then 1 else 0 end) as COLAT_appr

42 ,sum(case when final_decision = 'Approved' and affordability =1 then 1 else 0 end) as AFORD_appr

43 ,sum(case when final_decision = 'Approved' and fraud =1 then 1 else 0 end) as FRAUD_appr

44 ,sum(case when final_decision = 'Approved' and general =1 then 1 else 0 end) as GEN_appr

45 ,sum(case when final_decision = 'Approved' and internalconduct =1 then 1 else 0 end) as INCON_appr

46 ,sum(case when final_decision = 'Approved' and purpose =1 then 1 else 0 end) as PUR_appr

2 The SAS System 16:31 Friday, February 23, 2018

47 ,sum(case when final_decision = 'Approved' and borrower =1 then 1 else 0 end) as BOROW_appr

48 ,sum(case when final_decision = 'Approved' and forcerefer =1 then 1 else 0 end) as F_FER_appr

49 ,sum(case when final_decision = 'Approved' and expense =1 then 1 else 0 end) as EXPEN_appr

50

51 ,sum(ast) as Total_AST

52 ,sum(bureau) as T_BUREAU

53 , sum(collatoral) as T_COLLAT

54 , sum(affordability) as T_AFFORD

55 , sum(fraud) as T_FRAUD

56 , sum(general) as T_GENERAL

57 , sum(internalconduct) as T_I_CONDT

58 , sum(purpose) as T_PURPOSE

59 , sum(borrower) as T_BORROWER

60 , sum(forcerefer) as T_F_REFER

61 , sum(expense) as T_EXPENSE

62

63

64 from

65 tk.SBOS_final1

66

67

68 group by

69 app_type_flag , capacity_refer , collatoral_refer , policy_refer , character_refer,

70 ast, bureau , collatoral, affordability, fraud , general , internalconduct , purpose ,

71 borrower, forcerefer, expense, ac11, db21, ra03 , db23 , ra01 , rb21 , rb91 , rb95 ,

72 rb96 , rc01 , rfxx , re51, rg01 , rg18 , rg19 , rg15 , rg16, rg17 , ri01, ri02 , ri03

73 , ri04 , ri25, ri31, ri33 , ri45 , ri46 , rp03 , rp06 , rp07 , rp08 , rp10 , rp12

74 , avxx, datestamp, final_decision , F_Medico , SI_Final , FranchiseFlag_F ,

75 AppSystem, State, proposed_ccr, drawn_down_flag

76

77 ;

NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.

78 quit;

NOTE: The SAS System stopped processing this step because of errors.

NOTE: PROCEDURE SQL used (Total process time):

real time 0.00 seconds

cpu time 0.00 seconds

 

79

80 GOPTIONS NOACCESSIBLE;

81 %LET _CLIENTTASKLABEL=;

82 %LET _CLIENTPROJECTPATH=;

83 %LET _CLIENTPROJECTNAME=;

84 %LET _SASPROGRAMFILE=;

85

86 ;*';*";*/;quit;run;

87 ODS _ALL_ CLOSE;

88

89

90 QUIT; RUN;

91

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

In your first post, the offending line was:

drawn_down_flag as d-downflag

d-downflag is not a valid variable name,  d_downflag would work.  Hyphen vs. underscore.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

View solution in original post

3 REPLIES 3
LinusH
Tourmaline | Level 20
Hyphens isn't supported as SAS char in column name, unless you use the n literal and VALIDVARNAME=ANY.
Data never sleeps
bondtk
Quartz | Level 8
Do you mean , I can’t use proposed_ccr as p_ccr etc...
As I wrote the code again and it worked with hyphens, so not sure what was the error..
ChrisHemedinger
Community Manager

In your first post, the offending line was:

drawn_down_flag as d-downflag

d-downflag is not a valid variable name,  d_downflag would work.  Hyphen vs. underscore.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 5830 views
  • 1 like
  • 3 in conversation