BookmarkSubscribeRSS Feed
Macy
Calcite | Level 5

 

 

hi, I am trying to create new  table as below code, but it shows error like"ERROR: Unresolved reference to table/correlation name GCT."

can you help ? 

 

PROC SQL;
CREATE TABLE GCT.ORGANICS_IMPUTED_ALL
AS
SELECT GCT.DemCluster,GCT.DemGender,GCT.DemReg, GCT.DemTVReg
,(CASE
WHEN (DemCluster = '') THEN 'U'
ELSE DemCluster
END) AS IMP_DemCluster
,(CASE
WHEN (DemGender = '') THEN 'U'
ELSE DemGender
END) AS IMP_DemGender
,(CASE
WHEN (DemReg = '') THEN 'U'
ELSE DemReg
END) AS IMP_DemReg
,(CASE
WHEN (DemTVReg = '') THEN 'U'
ELSE DemTVReg
END) AS IMP_DemTVReg
,(CASE
WHEN (DemCluster = '') THEN 1
ELSE 0
END) AS M_DemCluster
,(CASE
WHEN (DemGender = '') THEN 1
ELSE 0
END) AS M_DemGender
,(CASE
WHEN (DemReg = '') THEN 1
ELSE 0
END) AS M_DemReg
,(CASE
WHEN (DemTVReg = '') THEN 1
ELSE 0
END) AS M_DemTVReg

FROM GCT.ORGANICS;
QUIT;

1 REPLY 1
Shmuel
Garnet | Level 18

You need a LIBNAME statement to point to the library where your data exist or should be saved,

like:

   libname gct "...path to the library ...";

 

also: in proc sql, when you use  a form of X.y - then

       X should be defined as reference to input dataset an

       y is a variable name.

Your code:

      SELECT GCT.DemCluster,  GCT.DemGender,  GCT.DemReg, GCT.DemTVReg

would be interpreted as: GCT is a reference

                while DemGender   DemReg   DemTVReg - are variables in your input

defined by:

              FROM GCT.ORGANICS;   

that should be changed into:

              FROM GCT.ORGANICS   as GCT;

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
  • 1 reply
  • 652 views
  • 0 likes
  • 2 in conversation