BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Shanthi123
Fluorite | Level 6
I have multiple sas programs and i have to change the table names to uppercase . How to do that .
Can someone help me on this?
1 ACCEPTED SOLUTION

Accepted Solutions
whymath
Lapis Lazuli | Level 10
What do you mean by "tablename"? All the names of SAS datasets?

View solution in original post

8 REPLIES 8
whymath
Lapis Lazuli | Level 10
What do you mean by "tablename"? All the names of SAS datasets?
Shanthi123
Fluorite | Level 6
Yes names of sas datasets in the coding .
SASKiwi
PROC Star

Why? SAS only retains dataset/table case in SAS log source code. Pretty much everywhere else in SAS they are printed in uppercase. For example in SAS log notes, procedure output and in Enterprise Guide in the Servers List.

 

On disk, SAS dataset/table filenames are displayed in lowercase regardless of case in SAS programs.

 

Shanthi123
Fluorite | Level 6
Yes , but in sas coding when i use snowflake database if the dataset name is in lower case its not reading. If it is in upper case its able to read so i need to replace the dataset names to uppercase.
Ksharp
Super User
libname x 'c:\temp\';
data x.have;
set sashelp.class;
run;


data _null_;
rc=rename('c:\temp\have.sas7bdat','c:\temp\HAVE.sas7bdat','file');
run;
Shanthi123
Fluorite | Level 6
My requirement is to change in sas entire code need to search the tables used in joins or set statement with library.
Like
Example

Proc sql;
Create table test as
Select * from gdvh. Table1
Left join gvhb.table2
;
Quit;
So it should change to
Proc sql;
Create table test as
Select * from gdvh. TABLE1
Left join gvhb.TABLE2
;
Quit;

Ksharp
Super User

That would lead you to render to a plain text process problem.

data _null_;
infile 'c:\temp\have.sas';
file 'c:\temp\want.sas';
input;
_infile_=prxchange('s/\b(\w+)\s*\.\s*(\w+)\b/\1.\U\2/',-1,_infile_);
put _infile_;
run;
Tom
Super User Tom
Super User

Please share some example code where the text of the name used in the code has any impact on the case of the name used in the SNOWFLAKE database.

 

The only way to get strange names for tables in Snowflake is to enclose the names in quotes.

create table schema.table as ...

Will make the name of table in the default case that snowflake uses.

But

create table schema."TaBle" as ...

will make the name in mixed case.  And once the name is in mixed case you have to always use the quotes when referencing it.

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 775 views
  • 0 likes
  • 5 in conversation