BookmarkSubscribeRSS Feed
Hagen
Calcite | Level 5

Hi there,

I merge some tables using SAS Enterprise Guide. Afterwards I create a report based on this merged data set. Is there any chance to change the database names of the attributes to a user friendly name, meaning using spaces and variable names with a length greater than 32 characters?

If this is possible, can I write a program in EG which renames all variables based on a csv-List (looking for example like: "databaseAttributeName;New Name With Special characters" ).

Thank you very much in advance for your answers

Best Regards

4 REPLIES 4
Reeza
Super User

Why not use labels for your variables instead?

label my_variable = 'Clean Variable Name';

Dorota_Jarosz
Obsidian | Level 7

SAS variable names cannot have embedded spaces or special characters. Labels are for this, as Reeza already stated. Once you define labels, the dataset can be viewed with labels and reports can be created/printed using labels rather than variable names using "label" option in a procedure call (e.g. proc print).

Hagen
Calcite | Level 5


Hi there,

thanks for your answers and sorry for coming back to you so late. I am trying the following script:

proc import datafile="c:\columnsdescriptions.xls"
   dbms=excel
   out=work.labels replace;
getnames=yes;
run;


*filename gencode temp;
filename gencode 'C:\gencode.sas';

data _null_;
set work.labels end=eof;
file gencode;

if _n_=1 then do;
  put "proc datasets lib=LIB nolist;"/
   "modify DEMO_CUSTOMERS;";
end;

put ' label ' variable ' = "' label '";';
if eof then put "quit;";
run;

*error occurs here:

%include gencode;
filename gencode clear;

this throws the error:  ERROR: The HEADER/VARIABLE UPDATE function is not supported by the ODBC engine.

I don't understand this error message, as I am just trying to change the internal label and not a column name in the database. Any ideas on how to solve that?

Best regards

Dorota_Jarosz
Obsidian | Level 7

What is your LIB library? Is it defined using the ODBC engine?

Perhaps it has something to do with the problem reported in this SAS note for Access to Oracle:

SAS/ACCESS® software's LIBNAME engines support creating tables as well as reading from and writing to tables, but they do not support table altering.

http://support.sas.com/kb/37/015.html

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
  • 4 replies
  • 1047 views
  • 6 likes
  • 3 in conversation