BookmarkSubscribeRSS Feed
milos_miletic
Calcite | Level 5

Hello, 

 

I have this error message, following my linear regression model on SAS:

 

"

ERROR 22-322: Erreur de syntaxe, l'une des valeurs suivantes est attendue : un nom, ;, COOKD, COVRATIO, DFFITS, H, L95, L95M, LCL,
LCLM, OUT, P, PRED, PREDICTED, PRESS, R, RESIDUAL, RSTUDENT, STDI, STDP, STDR, STUDENT, U95, U95M, UCL, UCLM.

ERROR 200-322: The symbol is not recognized and will be ignored.

97 RESIDUAL="residual_Y - GDP per capita (cu
ERROR: residual_Y does not have a numeric suffix.
97 RESIDUAL="residual_Y - GDP per capita (cu
_
22
ERROR 22-322: Erreur de syntaxe, l'une des valeurs suivantes est attendue : un nom, ;, -, COOKD, COVRATIO, DFFITS, H, L95, L95M,
LCL, LCLM, OUT, P, PRED, PREDICTED, PRESS, R, RESIDUAL, RSTUDENT, STDI, STDP, STDR, STUDENT, U95, U95M, UCL, UCLM.

97 RESIDUAL="residual_Y - GDP per capita (cu
_
76
ERROR 76-322: Syntax error, statement will be ignored.

98 STUDENT="
_
49"

 

This is the html code of the linear regression :

 

"

/* -------------------------------------------------------------------
Code généré par une tâche SAS

Généré le : lundi 2 décembre 2019 à 12:18:05
Par tâche : Régression linéaire

Données d'entrée : Local:WORK.DATASET FP
Serveur : Local
------------------------------------------------------------------- */
ODS GRAPHICS ON;

%_eg_conditional_dropds(WORK.PREDLINREGPREDICTIONS_0002,
WORK.SORTTEMPTABLESORTED_0002,
WORK.TMP1TempTableForPlots);
/* -------------------------------------------------------------------
Déterminez l'attribut de type de la table (si défini)
et le prépare pour l'ajout à la table/la vue, qui est
généré lors de l'étape suivante.
------------------------------------------------------------------- */
DATA _NULL_;
dsid = OPEN("WORK.'DATASET FP'n", "I");
dstype = ATTRC(DSID, "TYPE");
IF TRIM(dstype) = " " THEN
DO;
CALL SYMPUT("_EG_DSTYPE_", "");
CALL SYMPUT("_DSTYPE_VARS_", "");
END;
ELSE
DO;
CALL SYMPUT("_EG_DSTYPE_", "(TYPE=""" || TRIM(dstype) || """)");
IF VARNUM(dsid, "_NAME_") NE 0 AND VARNUM(dsid, "_TYPE_") NE 0 THEN
CALL SYMPUT("_DSTYPE_VARS_", "_TYPE_ _NAME_");
ELSE IF VARNUM(dsid, "_TYPE_") NE 0 THEN
CALL SYMPUT("_DSTYPE_VARS_", "_TYPE_");
ELSE IF VARNUM(dsid, "_NAME_") NE 0 THEN
CALL SYMPUT("_DSTYPE_VARS_", "_NAME_");
ELSE
CALL SYMPUT("_DSTYPE_VARS_", "");
END;
rc = CLOSE(dsid);
STOP;
RUN;

/* -------------------------------------------------------------------
Il est inutile de trier la table WORK.'DATASET FP'n.
------------------------------------------------------------------- */
DATA WORK.SORTTEMPTABLESORTED_0002 &_EG_DSTYPE_ / VIEW=WORK.SORTTEMPTABLESORTED_0002;
SET WORK.'DATASET FP'n;
RUN;
TITLE;
TITLE1 "Results of Global Linear Regression";
FOOTNOTE;
FOOTNOTE1 "Généré par SAS (&_SASSERVERNAME, &SYSSCPL) le %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) à %TRIM(%QSYSFUNC(TIME(), NLTIMAP25.))";
PROC REG DATA=WORK.SORTTEMPTABLESORTED_0002
PLOTS(ONLY)=RESIDUALHISTOGRAM
PLOTS(ONLY)=RESIDUALBYPREDICTED
PLOTS(ONLY)=OBSERVEDBYPREDICTED
PLOTS(ONLY)=QQPLOT
PLOTS(ONLY)=RFPLOT
PLOTS(ONLY)=DIAGNOSTICSPANEL
PLOTS(ONLY)=RESIDUALPANEL
;
Linear_Regression_Model: MODEL "Y - GDP per capita (current US$)"n = "Access to electricity (% of popu"n "Individuals using the Internet ("n "Secure Internet servers (per 1 m"n "Compulsory education, duration ("n "Foreign direct investment, net i"n "Merchandise exports (current US$"n "Urban population (% of total pop"n "Net migration"n "International tourism, number of"n "Life expectancy at birth, total"n "Infant deaths per birth"n
/ SELECTION=NONE
CLB
ALPHA=0.01
;

OUTPUT OUT=WORK.PREDLINREGPREDICTIONS_0002(LABEL="Prédictions et statistiques de régression linéaire pour WORK.'DATASET FP'n")
PREDICTED="predicted_Y - GDP per capita (c
RESIDUAL="residual_Y - GDP per capita (cu
STUDENT="student_Y - GDP per capita (cur
RSTUDENT="rstudent_Y - GDP per capita (cu
LCL="lcl_Y - GDP per capita (current
LCLM="lclm_Y - GDP per capita (curren
UCL="ucl_Y - GDP per capita (current
UCLM="uclm_Y - GDP per capita (curren ;
RUN;
QUIT;

/* -------------------------------------------------------------------
Fin du code de la tâche
------------------------------------------------------------------- */
RUN; QUIT;
%_eg_conditional_dropds(WORK.SORTTEMPTABLESORTED_0002,
WORK.TMP1TempTableForPlots);
TITLE; FOOTNOTE;
ODS GRAPHICS OFF;

"

 

Could you help me please ?

 

Thank you! 

 

Milos

 

5 REPLIES 5
Kurt_Bremser
Super User

Get rid of all these non-standard SAS names three days before yesterday; they force you to use these ugly name literals, which cause all kind of problems, starting with making the code unreadable, and the following problem.

Next, you have loads of unbalanced quotes here:

OUTPUT OUT=WORK.PREDLINREGPREDICTIONS_0002(LABEL="Prédictions et statistiques de régression linéaire pour WORK.'DATASET FP'n")
PREDICTED="predicted_Y - GDP per capita (c
RESIDUAL="residual_Y - GDP per capita (cu
STUDENT="student_Y - GDP per capita (cur
RSTUDENT="rstudent_Y - GDP per capita (cu
LCL="lcl_Y - GDP per capita (current
LCLM="lclm_Y - GDP per capita (curren
UCL="ucl_Y - GDP per capita (current
UCLM="uclm_Y - GDP per capita (curren ;

and what does the text

Linear_Regression_Model: 

do right in the middle of your proc reg code?

PaigeMiller
Diamond | Level 26

In addition to what @Kurt_Bremser said, we normally want to see the entire LOG, rather than the error messages disconnected from the code. That would make our debugging much easier. Please click on the {i} icon here at SAS communities and paste the log as text into the window that appears.

 

Linear_Regression_Model: 

is actually a valid part of the MODEL statement which names the model created, although naming a linear regression model to have the name Linear_Regression_Model seems somewhat pointless and extra and unnecessary typing to me. Normally, you'd only add such a name into the MODEL statement if you were computing two or more models in the same PROC REG.

 

--
Paige Miller
milos_miletic
Calcite | Level 5

Hello, 

 

This is the entire code of the linear regression : 

 

/* -------------------------------------------------------------------
   Code généré par une tâche SAS

   Généré le : lundi 2 décembre 2019 à 12:18:05
   Par tâche : Régression linéaire

   Données d'entrée : Local:WORK.DATASET FP
   Serveur :  Local
   ------------------------------------------------------------------- */
ODS GRAPHICS ON;

%_eg_conditional_dropds(WORK.PREDLINREGPREDICTIONS_0002,
		WORK.SORTTEMPTABLESORTED_0002,
		WORK.TMP1TempTableForPlots);
/* -------------------------------------------------------------------
   Déterminez l'attribut de type de la table (si défini)
   et le prépare pour l'ajout à la table/la vue, qui est
   généré lors de l'étape suivante.
   ------------------------------------------------------------------- */
DATA _NULL_;
	dsid = OPEN("WORK.'DATASET FP'n", "I");
	dstype = ATTRC(DSID, "TYPE");
	IF TRIM(dstype) = " " THEN
		DO;
		CALL SYMPUT("_EG_DSTYPE_", "");
		CALL SYMPUT("_DSTYPE_VARS_", "");
		END;
	ELSE
		DO;
		CALL SYMPUT("_EG_DSTYPE_", "(TYPE=""" || TRIM(dstype) || """)");
		IF VARNUM(dsid, "_NAME_") NE 0 AND VARNUM(dsid, "_TYPE_") NE 0 THEN
			CALL SYMPUT("_DSTYPE_VARS_", "_TYPE_ _NAME_");
		ELSE IF VARNUM(dsid, "_TYPE_") NE 0 THEN
			CALL SYMPUT("_DSTYPE_VARS_", "_TYPE_");
		ELSE IF VARNUM(dsid, "_NAME_") NE 0 THEN
			CALL SYMPUT("_DSTYPE_VARS_", "_NAME_");
		ELSE
			CALL SYMPUT("_DSTYPE_VARS_", "");
		END;
	rc = CLOSE(dsid);
	STOP;
RUN;

/* -------------------------------------------------------------------
   Il est inutile de trier la table WORK.'DATASET FP'n.
   ------------------------------------------------------------------- */
DATA WORK.SORTTEMPTABLESORTED_0002 &_EG_DSTYPE_ / VIEW=WORK.SORTTEMPTABLESORTED_0002;
	SET WORK.'DATASET FP'n;
RUN;
TITLE;
TITLE1 "Results of Global Linear Regression";
FOOTNOTE;
FOOTNOTE1 "Généré par SAS (&_SASSERVERNAME, &SYSSCPL) le %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) à %TRIM(%QSYSFUNC(TIME(), NLTIMAP25.))";
PROC REG DATA=WORK.SORTTEMPTABLESORTED_0002
		PLOTS(ONLY)=RESIDUALHISTOGRAM
		PLOTS(ONLY)=RESIDUALBYPREDICTED
		PLOTS(ONLY)=OBSERVEDBYPREDICTED
		PLOTS(ONLY)=QQPLOT
		PLOTS(ONLY)=RFPLOT
		PLOTS(ONLY)=DIAGNOSTICSPANEL
		PLOTS(ONLY)=RESIDUALPANEL
	;
	Linear_Regression_Model: MODEL "Y - GDP per capita (current US$)"n = "Access to electricity (% of popu"n "Individuals using the Internet ("n "Secure Internet servers (per 1 m"n "Compulsory education, duration ("n "Foreign direct investment, net i"n "Merchandise exports (current US$"n "Urban population (% of total pop"n "Net migration"n "International tourism, number of"n "Life expectancy at birth, total"n "Infant deaths per birth"n
		/		SELECTION=NONE
		CLB
		ALPHA=0.01
	;

	OUTPUT OUT=WORK.PREDLINREGPREDICTIONS_0002(LABEL="Prédictions et statistiques de régression linéaire pour WORK.'DATASET FP'n")
		PREDICTED="predicted_Y - GDP per capita (c 
		RESIDUAL="residual_Y - GDP per capita (cu 
		STUDENT="student_Y - GDP per capita (cur 
		RSTUDENT="rstudent_Y - GDP per capita (cu 
		LCL="lcl_Y - GDP per capita (current 
		LCLM="lclm_Y - GDP per capita (curren 
		UCL="ucl_Y - GDP per capita (current 
		UCLM="uclm_Y - GDP per capita (curren ;
RUN;
QUIT;

/* -------------------------------------------------------------------
   Fin du code de la tâche
   ------------------------------------------------------------------- */
RUN; QUIT;
%_eg_conditional_dropds(WORK.SORTTEMPTABLESORTED_0002,
		WORK.TMP1TempTableForPlots);
TITLE; FOOTNOTE;
ODS GRAPHICS OFF;

Do you need anything else ? 

 

Thank you for your help! 

Kurt_Bremser
Super User

This part:

		PREDICTED="predicted_Y - GDP per capita (c 
		RESIDUAL="residual_Y - GDP per capita (cu 
		STUDENT="student_Y - GDP per capita (cur 
		RSTUDENT="rstudent_Y - GDP per capita (cu 
		LCL="lcl_Y - GDP per capita (current 
		LCLM="lclm_Y - GDP per capita (curren 
		UCL="ucl_Y - GDP per capita (current 
		UCLM="uclm_Y - GDP per capita (curren ;

can't work because of the unbalanced quotes and the resulting syntax ERRORs.

PaigeMiller
Diamond | Level 26

@milos_miletic wrote:

Hello, 

 

This is the entire code of the linear regression : 

 

/* -------------------------------------------------------------------
   Code généré par une tâche SAS

   Généré le : lundi 2 décembre 2019 à 12:18:05
   Par tâche : Régression linéaire

   Données d'entrée : Local:WORK.DATASET FP
   Serveur :  Local
   ------------------------------------------------------------------- */
ODS GRAPHICS ON;

%_eg_conditional_dropds(WORK.PREDLINREGPREDICTIONS_0002,
		WORK.SORTTEMPTABLESORTED_0002,
		WORK.TMP1TempTableForPlots);
/* -------------------------------------------------------------------
   Déterminez l'attribut de type de la table (si défini)
   et le prépare pour l'ajout à la table/la vue, qui est
   généré lors de l'étape suivante.
   ------------------------------------------------------------------- */
DATA _NULL_;
	dsid = OPEN("WORK.'DATASET FP'n", "I");
	dstype = ATTRC(DSID, "TYPE");
	IF TRIM(dstype) = " " THEN
		DO;
		CALL SYMPUT("_EG_DSTYPE_", "");
		CALL SYMPUT("_DSTYPE_VARS_", "");
		END;
	ELSE
		DO;
		CALL SYMPUT("_EG_DSTYPE_", "(TYPE=""" || TRIM(dstype) || """)");
		IF VARNUM(dsid, "_NAME_") NE 0 AND VARNUM(dsid, "_TYPE_") NE 0 THEN
			CALL SYMPUT("_DSTYPE_VARS_", "_TYPE_ _NAME_");
		ELSE IF VARNUM(dsid, "_TYPE_") NE 0 THEN
			CALL SYMPUT("_DSTYPE_VARS_", "_TYPE_");
		ELSE IF VARNUM(dsid, "_NAME_") NE 0 THEN
			CALL SYMPUT("_DSTYPE_VARS_", "_NAME_");
		ELSE
			CALL SYMPUT("_DSTYPE_VARS_", "");
		END;
	rc = CLOSE(dsid);
	STOP;
RUN;

/* -------------------------------------------------------------------
   Il est inutile de trier la table WORK.'DATASET FP'n.
   ------------------------------------------------------------------- */
DATA WORK.SORTTEMPTABLESORTED_0002 &_EG_DSTYPE_ / VIEW=WORK.SORTTEMPTABLESORTED_0002;
	SET WORK.'DATASET FP'n;
RUN;
TITLE;
TITLE1 "Results of Global Linear Regression";
FOOTNOTE;
FOOTNOTE1 "Généré par SAS (&_SASSERVERNAME, &SYSSCPL) le %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) à %TRIM(%QSYSFUNC(TIME(), NLTIMAP25.))";
PROC REG DATA=WORK.SORTTEMPTABLESORTED_0002
		PLOTS(ONLY)=RESIDUALHISTOGRAM
		PLOTS(ONLY)=RESIDUALBYPREDICTED
		PLOTS(ONLY)=OBSERVEDBYPREDICTED
		PLOTS(ONLY)=QQPLOT
		PLOTS(ONLY)=RFPLOT
		PLOTS(ONLY)=DIAGNOSTICSPANEL
		PLOTS(ONLY)=RESIDUALPANEL
	;
	Linear_Regression_Model: MODEL "Y - GDP per capita (current US$)"n = "Access to electricity (% of popu"n "Individuals using the Internet ("n "Secure Internet servers (per 1 m"n "Compulsory education, duration ("n "Foreign direct investment, net i"n "Merchandise exports (current US$"n "Urban population (% of total pop"n "Net migration"n "International tourism, number of"n "Life expectancy at birth, total"n "Infant deaths per birth"n
		/		SELECTION=NONE
		CLB
		ALPHA=0.01
	;

	OUTPUT OUT=WORK.PREDLINREGPREDICTIONS_0002(LABEL="Prédictions et statistiques de régression linéaire pour WORK.'DATASET FP'n")
		PREDICTED="predicted_Y - GDP per capita (c 
		RESIDUAL="residual_Y - GDP per capita (cu 
		STUDENT="student_Y - GDP per capita (cur 
		RSTUDENT="rstudent_Y - GDP per capita (cu 
		LCL="lcl_Y - GDP per capita (current 
		LCLM="lclm_Y - GDP per capita (curren 
		UCL="ucl_Y - GDP per capita (current 
		UCLM="uclm_Y - GDP per capita (curren ;
RUN;
QUIT;

/* -------------------------------------------------------------------
   Fin du code de la tâche
   ------------------------------------------------------------------- */
RUN; QUIT;
%_eg_conditional_dropds(WORK.SORTTEMPTABLESORTED_0002,
		WORK.TMP1TempTableForPlots);
TITLE; FOOTNOTE;
ODS GRAPHICS OFF;

Do you need anything else ? 

 


Well, yes, I do need something else, and I didn't really ask for this. I want to see the entire LOG, not just the error messages, but the entire SAS log, so we can match up the error message with the actual location in the code where the error occurs.

 

But it seems that @Kurt_Bremser has found serious problems, which you need to address.

--
Paige Miller

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 1252 views
  • 0 likes
  • 3 in conversation