FourthExam.docx - STAT 483 Haixing Yin Forth Exam Problem 1 Editor Name Haixing Yin Date Purpose 4th exam OPTION PS=58 LS=80 NODATE NONUMBER CENTER

FourthExam.docx - STAT 483 Haixing Yin Forth Exam Problem 1...

This preview shows page 1 - 3 out of 9 pages.

STAT 483 Haixing Yin Forth Exam Problem 1 Editor: /************************************************************* Name: Haixing Yin Date: 03/29/2016 Purpose: 4th exam **************************************************************/ OPTION PS = 58 LS = 80 NODATE NONUMBER CENTER ; LIBNAME STAT483 'D:\STAT\483\Data' ; DATA namesin; infile 'D:\STAT\483\Data\namesin.dat' ; INPUT @ 1 name & $20. @ 21 phone & $14. @ 36 SSN & $11. ; *format of name: last,first; first = scan(name , 1 ); last = scan(name,- 1 ); Newname =(trim)last || ', ' ||first; * format of phone: (***)***-****; phone1 = substr(phone, 2 , 3 ); phone2 = substr(phone, 6 , 3 ); phone3 = substr(phone, 10 , 4 ); Newphone = '(' ||trim(phone1)|| ')' ||trim(phone2)|| '-' ||phone3; *format of ssn: ********; NewSSN = compress(SSN, '(-) ' ); RUN ; PROC PRINT data = namesin NOOBS ; title 'The namesin date set' ; var Newname Newphone NewSSN; RUN ; Log: 461 /************************************************************* 462 Name: Haixing Yin 463 Date: 03/29/2016 464 Purpose: 4th exam 465 **************************************************************/ 466 OPTION PS=58 LS=80 NODATE NONUMBER CENTER; 467 LIBNAME STAT483 'D:\STAT\483\Data'; NOTE: Libref STAT483 was successfully assigned as follows: Engine: V9
Physical Name: D:\STAT\483\Data 468 DATA namesin; 469 infile 'D:\STAT\483\Data\namesin.dat'; 470 INPUT @1 name & $20. @21 phone & $14. @36 SSN & $11.; 471 *format of name: last,first; 472 first = scan(name ,1); 473 last = scan(name,-1); 474 Newname =last || ', '||first; 475 * format of phone: (***)***-****; 476 phone1 = substr(phone,2,3); 477 phone2 = substr(phone,6,3); 478 phone3 = substr(phone,10,4); 479 Newphone = '('||trim(phone1)||')'||trim(phone2)||'-'||phone3; 480 *format of ssn: ********; 481 NewSSN = compress(SSN,'(-) '); 482 RUN; NOTE: The infile 'D:\STAT\483\Data\namesin.dat' is: Filename=D:\STAT\483\Data\namesin.dat, RECFM=V,LRECL=32767,File Size (bytes)=488, Last Modified=2016 03 29 21 28 06 , Create Time=2016 03 29 21 28 08 NOTE: 10 records were read from the infile 'D:\STAT\483\Data\namesin.dat'. The minimum record length was 47. The maximum record length was 47. NOTE: The data set WORK.NAMESIN has 10 observations and 11 variables. NOTE: DATA statement used (Total process time): real time 0.03 seconds cpu time 0.03 seconds 483 484 PROC PRINT data= namesin NOOBS; 485 title 'The namesin date set'; 486 var Newname Newphone NewSSN; 487 RUN; NOTE: There were 10 observations read from the data set WORK.NAMESIN.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture