Hello,
Please, can someone assist me with this question. I want to add another column to my data set in sas studio which has 138435 observations and 22 variables. I would like the new column to be the 23 variable.
If you want code, here is an example:
data want;
set have;
twenty_third_variable=temperature_celsius*9/5 + 32; /* or any other value you want */
run;
If you want to do this via menus only, then I defer to others.
Can you tell us the source of the column? Will it be from another SAS dataset? Is it based on a calculation (as in @PaigeMiller's response)? Is it from a file? A database? How will you obtain this value?
Adding a new column to a SAS dataset is pretty easy. Say you have an existing data set, let's call it "Have." If you want to add a column to the data, one way is a Data step, for example, the below. In my existing data, if I have a column named "Centimeters" but I want a new column called "Inches," I can create a new column by using the standard conversion formula as shown.
Data Want;
Set Have;
Inches = Centimeters / 2.54;
Run;
The output of the above Data set will be a new dataset named "Want". The new data set will be a copy of Have but will have a new column added to, a column named "Inches."
Jim
To re-phrase @jimbarbour comments into Paige-speak:
Be specific. By providing more information and specific information, you will get faster and better answers.
General and vague questions get general and vague answers. Specific questions get specific answers.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.