1

Very new to SAS programming 0.0 I am trying to change the title "Listing of Data Set Health" to all uppercase and what I am doing isn't working. PLS HELP.

proc format;
value $Gender
'M'='Male'
'F'='Female'
other= 'Unknown'; * Handle Missing Values;
run;
data health;
infile '/folders/myfolders/health.txt' pad;
input @1 Subj $3.
@4 Gender $1.
@5 (Age HR) (2.)
@9 (SBP DBP Chol) (3.);



if Chol gt 200 then do;
Stoke_Risk = 'High';
LDL_Group = 'Bad';
end;

if Age le 21 then Age_Group = 1;
else if Age le 59 then Age_Group = 2;
else if Age ge 60 then Age_Group = 3;

format Gender $Gender.; *this line could be under data or proc
print;

Current_Year = year(today()); *current year based on today and year function;
Short_Gender = lowcase(Gender); *lower case function for string;
ABP = mean(SBP, DBP); *mean of blood pressure;

run;

title "Listing of Data Set Health";
proc print data=health;
ID Subj;
run;
Hillary Oh
  • 21
  • 2
  • SAS proc variable names seem to be case insensitive. It may repeat the first used case format (upper, lower, mixed) during your session. Try logging out, then logging in and re-define the proc variable using all caps. ("SAS is not case-sensitive. You can use capital or lowercase letters in your SAS variables." https://campusguides.lib.utah.edu/c.php?g=160854&p=2455181 ) – Jennifer Yoon Aug 04 '20 at 21:28

3 Answers3

0

The title statement is a global statement that is used in open code. If you would like it to always be upper-case, you will want to type your title directly in upper-case:

title "LISTING OF DATA SET HEALTH";

If you want to be able to have it always be in upper-case no matter what you type, you will need to delve into the SAS Macro Facility and macro functions. This is a more advanced aspect of SAS that you will get into later.

The %upcase() macro function can be used in open code to convert any text to upper-case.

title "%upcase(listing of data set health)";

Note that this function differs from upcase(), which you will use in the data step. Functions starting with % are special macro functions.

Stu Sztukowski
  • 10,597
  • 1
  • 12
  • 21
0

You can explicitly change it to uppercase in the title statement:

title "LISTING OF DATA SET HEALTH";

If you want to change the title dynamically, you could write a macro like:

%let title = "Listing of Data Set Health";
title "%upcase(&title.)";
user2813606
  • 797
  • 2
  • 13
  • 37
-1

This will work:

Title %upcase("Listing of Data Set Health");
Tyler2P
  • 2,324
  • 26
  • 22
  • 31