How do I format an old sas program that has one column of a list of different variables that need sorting. Especially if the variables have a period in their names? I hope you understood. Thank you.
the question goes for finding a confidence interval for these variables that are categorical variables and when i did proc contents there was only one variable listed instead of the five different variables that are in the old sas program. So I need to resort the program so it shows that there are five different variables instead of one and need an analysis of that data after its been manipulated. I think I know how to do the analysis part but I'm having trouble with formatting the old information.
Show the program.
Variables typically do not have periods in their names. That would require creating variables with the System option VALIDVARNAME set to ANY and would require referencing them as name literals such as 'stupid.variablename'n
You posted a screenshot of something that seems to be showing a variable named TYPE. Type looks like it is a character variable with values that contain periods.
Do you have a quesiton?
You seem to be having a lot of trouble explaining what you want. It does not help that you appear to be using two different definitions of the word variable at the same time. In SAS a dataset has one or more variables. The dataset can have multiple observations. Each observation in the dataset has one value for each of the variables.
Perhaps you are asking how to parse a string into multiple values? If you have variable with values like
B1.1.2
B2.2.3
And you want to split those at the periods then use the SCAN() function.
data want;
set have;
length new1-new3 $10;
new1=scan(type,1,'.');
new2=scan(type,2,'.');
new3=scan(type,3,'.');
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.