23%mp_assertscope(SNAPSHOT)
24%mp_ds2csv(work.somedata,outfile=
"&_sasjs_work/test1.csv")
25%mp_assertscope(COMPARE)
29 infile
"&_sasjs_work/test1.csv";
32 if _n_=1 then call symputx(
'test1a',_infile_);
33 else if _infile_=:
'1," t""w""o",.Z' then call symputx(
'test1b',
'PASS');
37 iftrue=(
"&test1a"=
"x factor, Y, Z"),
38 desc=Checking header row Test 1,
39 outds=work.test_results
42 iftrue=(
"&test1b"=
"PASS"),
43 desc=Checking data row Test 1,
44 outds=work.test_results
50filename test2
"&_sasjs_work/test2.csv";
51%mp_ds2csv(work.somedata,outref=test2,dlm=SEMICOLON,headerformat=NAME)
58 if _n_=1 then call symputx('test2a',_infile_);
59 else if _infile_=:'1;
" t""w""o";.Z' then call symputx('test2b
','PASS');
63 iftrue=(
"&test2a"=
"X; Y; Z"),
64 desc=Checking header row Test 2,
65 outds=work.test_results
68 iftrue=(
"&test2b"=
"PASS"),
69 desc=Checking data row Test 2,
70 outds=work.test_results
76filename test3
"&_sasjs_work/test3.csv";
77%mp_ds2csv(work.somedata,outref=test3,headerformat=SASJS)
84 if _n_=1 then call symputx('test3a',_infile_);
85 else if _infile_=:'1,
" t""w""o",.Z' then call symputx('test3b
','PASS');
89 iftrue=(
"&test3a"=
"X:best32. Y:$char7. Z:best32."),
90 desc=Checking header row Test 3,
91 outds=work.test_results
94 iftrue=(
"&test3b"=
"PASS"),
95 desc=Checking data row Test 3,
96 outds=work.test_results
102Name length= $18 label=
"Player's Name"
103Team length= $14 label=
"Team at the End of 1986"
104nAtBat length= 8 label=
"Times at Bat in 1986"
105nHits length= 8 label=
"Hits in 1986"
106nHome length= 8 label=
"Home Runs in 1986"
107nRuns length= 8 label=
"Runs in 1986"
108nRBI length= 8 label=
"RBIs in 1986"
109nBB length= 8 label=
"Walks in 1986"
110YrMajor length= 8 label=
"Years in the Major Leagues"
111CrAtBat length= 8 label=
"Career Times at Bat"
112CrHits length= 8 label=
"Career Hits"
113CrHome length= 8 label=
"Career Home Runs"
114CrRuns length= 8 label=
"Career Runs"
115CrRbi length= 8 label=
"Career RBIs"
116CrBB length= 8 label=
"Career Walks"
117League length= $8 label=
"League at the End of 1986"
118Division length= $8 label=
"Division at the End of 1986"
119Position length= $8 label=
"Position(s) in 1986"
120nOuts length= 8 label=
"Put Outs in 1986"
121nAssts length= 8 label=
"Assists in 1986"
122nError length= 8 label=
"Errors in 1986"
123Salary length= 8 label=
"1987 Salary in $ Thousands"
124Div length= $16 label=
"League and Division"
125logSalary length= 8 label=
"Log Salary"
154missing a b c d e f g h i j k l m n o p q r s t u v w x y z _;
156if not missing(logSalary) then logsalary=logSalary*1;
158"Allanson, Andy",Cleveland,293,66,1,30,29,14,1,293,66,1,30,29,14,American,East,C,446,33,20,.,AE,.
159"Ashby, Alan",Houston,315,81,7,24,38,39,14,3449,835,69,321,414,375,National,West,C,632,43,10,475,NW,6.16331480403464
160"Davis, Alan",Seattle,479,130,18,66,72,76,3,1624,457,63,224,266,263,American,West,1B,880,82,14,480,AW,6.17378610390193
161"Dawson, Andre",Montreal,496,141,20,65,78,37,11,5628,1575,225,828,838,354,National,East,RF,200,11,3,500,NE,6.21460809842219
162"Galarraga, Andres",Montreal,321,87,10,39,42,30,2,396,101,12,48,46,33,National,East,1B,805,40,4,91.5,NE,4.51633897228147
163"Griffin, Alfredo",Oakland,594,169,4,74,51,35,11,4408,1133,19,501,336,194,American,West,SS,282,421,25,750,AW,6.62007320653035
164"Newman, Al",Montreal,185,37,1,23,8,21,2,214,42,1,30,9,24,National,East,2B,76,127,7,70,NE,4.24849524204936
165"Salazar, Argenis",Kansas City,298,73,0,24,24,7,3,509,108,0,41,37,12,American,West,SS,121,283,9,100,AW,4.60517018598809
166"Thomas, Andres",Atlanta,323,81,6,26,32,8,2,341,86,6,32,34,8,National,West,SS,143,290,19,75,NW,4.31748811353631
167"Thornton, Andre",Cleveland,401,92,17,49,66,65,13,5206,1332,253,784,890,866,American,East,DH,0,0,0,1100,AE,7.00306545878646
168"Trammell, Alan",Detroit,574,159,21,107,75,59,10,4631,1300,90,702,504,488,American,East,SS,238,445,22,517.143,AE,6.24831943200756
169"Trevino, Alex",Los Angeles,202,53,4,31,26,27,9,1876,467,15,192,186,161,National,West,C,304,45,11,512.5,NW,6.23930071101256
170"Van Slyke, Andy",St Louis,418,113,13,48,61,47,4,1512,392,41,205,204,203,National,East,RF,211,11,7,550,NE,6.30991827822651
171"Wiggins, Alan",Baltimore,239,60,0,30,11,22,6,1941,510,4,309,103,207,American,East,2B,121,151,6,700,AE,6.5510803350434
172"Almon, Bill",Pittsburgh,196,43,7,29,27,30,13,3231,825,36,376,290,238,National,East,UT,80,45,8,240,NE,5.48063892334199
173"Beane, Billy",Minneapolis,183,39,3,20,15,11,3,201,42,3,20,16,11,American,West,OF,118,0,0,.,AW,.
174"Bell, Buddy",Cincinnati,568,158,20,89,75,73,15,8068,2273,177,1045,993,732,National,West,3B,105,290,10,775,NW,6.65286302935334
175"Biancalana, Buddy",Kansas City,190,46,2,24,8,15,5,479,102,5,65,23,39,American,West,SS,102,177,16,175,AW,5.16478597392351
176"Bochte, Bruce",Oakland,407,104,6,57,43,65,12,5233,1478,100,643,658,653,American,West,1B,912,88,9,.,AW,.
179filename example temp lrecl=5000;
180%mp_ds2csv(work.baseball,outref=example,headerformat=SASJS)
181data _null_; infile example; input;put _infile_; if _n_>5 then stop;run;
186 call symputx('stmnt',_infile_);
190 infile example dsd firstobs=2;
196 desc=Checking syscc prior to compare of work.baseball,
197 outds=work.test_results
200proc compare base=want compare=work.baseball
201 method = absolute criterion = 0.0000000001 ;
204 iftrue=(&sysinfo le 41),
205 desc=Checking compare of work.baseball,
206 outds=work.test_results
216 format x date9. y datetime19. z time.;
218%mp_ds2csv(work.test5,outref=f2,headerformat=SASJS)
219data _null_; infile example; input;put _infile_; if _n_>5 then stop;run;
225 call symputx('stmnt2',_infile_);
229 infile f2 dsd firstobs=2;
236 desc=Checking syscc prior to compare of test5,
237 outds=work.test_results
240proc compare base=want5 compare=work.test5;
243 iftrue=(&sysinfo le 41),
244 desc=Checking compare of work.test5,
245 outds=work.test_results