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.
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 16. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: