- 首页 > it技术 > >
Data homegarden;
INFILE cards;
INPUT Name $ 1-7 Tomato Zucchini Peas Grapes;
Zone = 14;
Type = 'home';
Zucchini = Zucchini*10;
Total = Tomato+Zucchini + peas + Grapes;
PerTom = (Tomato/Total)*100;
cards;
Gregor 102 40 0 14
Molly155 10 1000
Luther 50 10 15 50
Susan200 .20
;
Proc print Data=https://www.it610.com/article/homegarden;
Title'home gardening survey';
run;
Data pumpkin;
inFile cards;
input name $1-16 age type $1. +1 date MMDDYY10. s1 s2 s3 s4 s5;
type = upcase(type);
avgscore = mean(s1,s2,s3,s4,s5);
DayEntered = Day(date);
cards;
Alicia Grossman13 c 10-28-2003 7.8 6.5 7.2 8.0 7.9
Matthew Lee9 D 10-30-2003 6.5 5.9 6.8 6.0 8.1
Elizabeth Garcia10 C 10-29-2003 8.9 7.9 8.5 9.0 8.8
;
proc print data=https://www.it610.com/article/pumpkin;
run;
data cars;
infile cards;
input name $ year make $ seats color $;
if year < 1975 then status ='classic';
if name = 'Corvette' or name = 'Camaro' then make = 'Chevy';
if name = 'Miata' then Do;
make = 'mazda';
seats = 2;
end;
cards;
Corvette 1955 .2 black
XJ61995 Jaguar2 teal
Mustang1966 Ford4 red
Miata2002 .. silver
CRX2001 Honda2 black
Camaro2000 .4 red
;
proc print data=https://www.it610.com/article/cars;
run;
data home;
infile cards;
input name $1-7 works $9-33 cost;
if cost ='.' then costgroup = 'missing';
else if cost > 50000 then costgroup = 'high';
else if cost < 10000 then costgroup = 'low';
else costgroup = 'medium';
cards;
BobKitchen cabinet face-lift1253.00
Shirley bathroom addition11350.70
Silviapaint exterior.
Albackyard gazebo3098.63
Normpaint interior647.77
Kathysecond floor additon75362.93
;
proc print data=https://www.it610.com/article/home;
run;
data Shakespeare;
infile cards;
input name $ 1-25 year type $;
if type ='comedy';
cards;
A Midsummer Night's Dream 1595 comedy
Comedy of Errors1590 comedy
Hamlet1600 tragedy
Macbeth1606 tragedy
Richard III1594 history
Romeo and Julirt1596 tragedy
Taming of the Shrew1593 comedy
Tempest1611 romance
;
proc print data=https://www.it610.com/article/shakespeare;
run;
data date;
infile cards;
input name $1-11 +3 birthday date9. +1 IssueDate MMDDYY10.;
ExpireDate = IssueDate + (365.25*3);
ExpireQuarter = QTR(ExpireDate);
if IssueDate> '01JAN2003'D then NewCard = 'yes';
cards;
A. Jones1jan609-15-03
M. Rincon05oCT1949 02-29-2000
Z. Grandage18mar1988 10-10-2002
K. Kaminaka29may2001 01-24-2003
;
proc print data=https://www.it610.com/article/date;
Format IssueDate MMDDYY10.;
Format birthday YYMMDD10.;
Format ExpireDate weekdate17.;
run;
data games;
infile cards;
input day $players $20. hits runs;
retain var 0;
var = sum(var, runs);
retain maxrun 0;
maxrun = max(maxrun, runs);
cards;
6-19 Columbia Peaches8 3
6-20 Columbia Peaches10 5
6-23 Plains Peanuts3 4
6-24 Plains Peanuts7 2
6-25 Plains Peanuts12 8
6-30 Gilroy Garlics4 4
7-1Gilroy Garlics9 4
7-4Sacramento Tomatoes15 9
7-4Sacramento Tomatoes10 10
7-5Sacramento Tomatoes23
;
proc print data=games;
run;
推荐阅读