BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
proc sql;
create table curr_util as 
select org, 
acc,
"curr_util" as sum_type,
sum(BAL,PBI_BAL)/LIMIT as sum_value,
from pbi;

what does this quotation mark doing here? why is it required?

 

3 REPLIES 3
PaigeMiller
Diamond | Level 26

For SAS to understand that the programmer means you have a text string, the text string must be in quotes. Otherwise, if you write curr_util without the quotes, SAS thinks that curr_util is the name of a variable.

--
Paige Miller
Astounding
PROC Star

Quotation marks have the same meaning throughout all applications of the SAS software.

 

No quotation marks refers to a variable's value.  It would mean the value of the variable CURR_UTIL should be the value assigned to the new variable SUM_TYPE.

 

Quotation marks refers to a set of characters.  It would mean the nine characters "curr_util" should be assigned to the new variable SUM_TYPE (same value for every observation).

ballardw
Super User

For many "why" questions I ask the original programmer if possible. Or read any comments.

 

The result is adding the same literal text to all of the records in a new variable.

 

When I see a variable containing the value of a data set name like this I suspect that somewhere else this result is combined with some other data and this variable indicates which data set contributed the record.

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