The raw data displayed below contains values for the following variables:
Write a DATA step that reads in the value for League, tests it, keeps only observations with a value of ‘American’, and produces an output data set containing all 4 variables.
This is my code so far:
data WORK.Illus;
infiles datalines delimiter = ' ';
input League $8. @;
if League = 'American';
input Team $18.
Wins 2
Losses 2;
datalines;
National New York Mets 19 12
American Toronto Blue Jays 19 13
American Boston Red Sox 17 12
National St Louis Cardinals 13 11
;
This is all I get in my table. What can I do to actually get the data I need in the table?
Post code and especially the data using the Insert Code or Insert SAS code buttons in the editor.
Otherwise important information, like which columns the data is in, whether there is anything to make the end of the team name, etc. will be lost because the forum will format your post into paragraphs.
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!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.