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

I am having problems trying to schedule a SAS program with EG because of long variable names in a table I have no control over.

This table specifically has 3 variables that have names with the same 32 first characters. The names are up to 40 characters long!

SAS handles this for me but EG does not seem to do that. Any ideas?

 

1 ACCEPTED SOLUTION

Accepted Solutions
SallyS
Fluorite | Level 6

Thank you all for trying to help me with this.

I have found the solution and am so very happy!

All I had to do was add 1 line (options VALIDVARNAME=V7; run;) prior to my sas program.

Perfect results.

Thanks again.

Sally

View solution in original post

8 REPLIES 8
SASKiwi
PROC Star

When you say EG does not handle long variable names what do you mean? Please provide more details.

 

When SAS truncates long variable names it will rename them by adding a digit on the end if they are no longer unique. Is this the behaviour you are seeing?

SallyS
Fluorite | Level 6

I am adding the coding I am using to try and access this data (note that I am not including all variables but am including the long named variables).

DATA ACCT_DETAIL; SET MyLibrary.Thedata (rename=(
AccountingDetailID=acct_id
AccountingDetail_AccountingNumbe=acct_num
AccountingDetail_ClaimReceivedDa=claimreceiveddate
AccountingDetail_ClaimStatus=claimstatus
AccountingDetail_ExtendedClaimSt=extclaimstatus_id
AccountingDetail_ExtendedClaimS0=extclaimstatus
AccountingDetail_ExtendedClaimS1=extclaimstatus_mrp
LastUpdate=last_update
)); run;

The variables that are in bold are providing the problem. 

When I look at the data through SAS these are the names I see (already truncated and made unique by SAS).

 

The following is from the log:

ERROR: Variable AccountingDetail_ExtendedClaimS0 is not on file MyLibrary.Thedata.
ERROR: Variable AccountingDetail_ExtendedClaimS1 is not on file MyLibrary.Thedata.
ERROR: Invalid DROP, KEEP, or RENAME option on file MyLibrary.Thedata.

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.ACCT_DETAIL may be incomplete. When this step was stopped there
were 0 observations and 0 variables.
WARNING: Data set WORK.ACCT_DETAIL was not replaced because this step was stopped.

LinusH
Tourmaline | Level 20

Are these three variables stored in an external RDBMS that allows longer column names? If yes, this should be handled when assigning the libanme.

Or are they created as a step in your process flow? Pls. give us an example (code/log).

Data never sleeps
SallyS
Fluorite | Level 6
I added my code and the results from the log in my response to message 3. I have no control over the table itself. If I did I would not have created such long names!!
SASKiwi
PROC Star

If you view the table properties in the EG server list for this table what does it report for the long column names? 

SallyS
Fluorite | Level 6

The results from the 'table properties' is:

 

10 AccountingDetail_ExtendedClaimSt Num 8 11. 11. AccountingDetail_ExtendedClaimStatusID
11 AccountingDetail_ExtendedClaimSt Char 255 $255. $255. AccountingDetail_ExtendedClaimStatus
12 AccountingDetail_ExtendedClaimSt Char 50 $50. $50. AccountingDetail_ExtendedClaimStatusMrp

 

Showing that EG truncates the names but does not do the adjustment (i.e., truncate to 31 and add a number) to make them unique.

I am truly at a loss so appreciate any help.

Thanks,

SallyS
 

SallyS
Fluorite | Level 6

Thank you all for trying to help me with this.

I have found the solution and am so very happy!

All I had to do was add 1 line (options VALIDVARNAME=V7; run;) prior to my sas program.

Perfect results.

Thanks again.

Sally

SASKiwi
PROC Star

Great! That was going to be the next thing I was going to suggest. VALIDVARNAME = ANY is set as default in EG which is not the default if you use SAS outside of EG. For compatibility it is good to set VALIDVARNAME = V7 for all EG use unless you need to maintain non-standard column names for some purpose.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 8 replies
  • 3169 views
  • 0 likes
  • 3 in conversation