Hi....I am trying to correct a EffectiveWithdrawDate on a student record and I am getting an "Invalid numeric data". I tried double quotes around the datetime and get an error message. Any suggestion on how to deal with this.....Thanks.
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL='Program (3)';
4 %LET _CLIENTPROCESSFLOWNAME='Process Flow';
5 %LET _CLIENTPROJECTPATH='';
6 %LET _CLIENTPROJECTPATHHOST='';
7 %LET _CLIENTPROJECTNAME='';
8 %LET _SASPROGRAMFILE='';
9 %LET _SASPROGRAMFILEHOST='';
10
11 ODS _ALL_ CLOSE;
12 OPTIONS DEV=PNG;
13 GOPTIONS XPIXELS=0 YPIXELS=0;
14 FILENAME EGSR TEMP;
15 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
16 STYLE=HTMLBlue
17 STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/7.1/Styles/HTMLBlue.css")
18 NOGTITLE
19 NOGFOOTNOTE
20 GPATH=&sasworklocation
21 ENCODING=UTF8
22 options(rolap="on")
23 ;
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
24
25 GOPTIONS ACCESSIBLE;
26
27 data DropBag1;
28 length DropBagID 8 StudentUID 8 TermCalendarID 8 Department $ 5 CourseID $ 5 CourseType $ 5 Section $ 5 CourseName $ 60
28 ! CollegeID 8 Credits 8 Grade $ 5 LastUpdate 8 EffectsTermGPA $ 3 EffectsCumGPA $ 3 CategoryID 8 GradePoint 8 CreditFactor
28 ! 8 TermEarned 8 CumulativeEarned 8 TermGPAHours 8 CumulativeGPAHours 8
29 MidTermGrade $ 2 MidTermPoints 8 ShowGradeReport $ 3 ShowTranscript $ 3 OverallGradePoint 8
29 ! OverallCreditFactor 8 ShowAdvisorTranscript $ 3 GPAGroupID 8 RegistrationStatus $ 40 ClockHours 8 StartDate 8
29 ! CompletionDate 8 FacultyID 8 PreviousGrade $ 2 StartInputDate 8 CompletionInputDate 8 IgnoreRepeats $ 3
30 Repeat $ 3 TranscriptATTHours 8 TranscriptERNHours $ 3 EffectiveRegDate 8 DropUserID $ 15 DropTime 8
30 ! SracademicID 8 SrofferID 8 MatchSRMasterID 8 IncludeHopeGPA 8 WritingIntensive 8 Honors 8 NumberGradeFinal 8
30 ! NumberGradeMidTerm 8 EffectiveAddDate 8 EffectiveWithdrawDate 8;
31 format Department $char5. CourseID $char5. CourseType $char5. Section $char5. CourseName $char60. Grade $char5.
31 ! LastUpdate DATETIME20. EffectsTermGPA $char3. EffectsCumGPA $char3. MidTermGrade $char2. ShowGradeReport $char3.
31 ! ShowTranscript $char3. ShowAdvisorTranscript $char3. RegistrationStatus $char40.
32 StartDate DATETIME22.3 CompletionDate DATETIME22.3 StartInputDate DATETIME22.3 CompletionInputDate
32 ! DATETIME22.3 IgnoreRepeats $char3. Repeat $char3. TranscriptERNHours $char3. EffectiveRegDate DATETIME22.3
32 ! DropUserID $char15. DropTime DATETIME22.3 EffectiveAddDate DATETIME22.3 EffectiveWithdrawDate DATETIME22.3;
33 set sqldb.DropBag;
34 if StudentUID in (13125) and TermCalendarID in (104) and Department in ('NCT') then do;
35 CourseName = 'Cisco Level II';
36 EffectiveWithdrawDate = '15APR2015:00:00:00.000';
37 end;
38 run;
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
36:37
NOTE: Invalid numeric data, '15APR2015:00:00:00.000' , at line 36 column 37.
DropBagID=17617 StudentUID=13125 TermCalendarID=104 Department=NCT CourseID=060 CourseType=40S Section=CECP3
CourseName=Cisco Level II CollegeID=0 Credits=1 Grade= LastUpdate=30MAR2015:16:04:00 EffectsTermGPA=Yes EffectsCumGPA=Yes
CategoryID=1099 GradePoint=0 CreditFactor=0 TermEarned=0 CumulativeEarned=0 TermGPAHours=0 CumulativeGPAHours=0 MidTermGrade=
MidTermPoints=0 ShowGradeReport=Yes ShowTranscript=Yes OverallGradePoint=0 OverallCreditFactor=0 ShowAdvisorTranscript=Yes
GPAGroupID=0 RegistrationStatus=Official ClockHours=0 StartDate=10FEB2015:00:00:00.000 CompletionDate=16APR2015:00:00:00.000
2 The SAS System 11:02 Thursday, June 9, 2022
FacultyID=0 PreviousGrade= StartInputDate=. CompletionInputDate=. IgnoreRepeats=No Repeat=No TranscriptATTHours=1
TranscriptERNHours=Yes EffectiveRegDate=15APR2015:00:00:00.000 DropUserID=PENHEC DropTime=15APR2015:14:19:00.000
SracademicID=1213294 SrofferID=24691 MatchSRMasterID=. IncludeHopeGPA=1 WritingIntensive=0 Honors=0 NumberGradeFinal=.
NumberGradeMidTerm=. EffectiveAddDate=10FEB2015:16:03:55.000 EffectiveWithdrawDate=. _ERROR_=1 _N_=842
EffectiveWithdrawDate = '15APR2015:00:00:00.000';
makes EffectiveWithdrawData a character string. It should be
EffectiveWithdrawDate = '15APR2015:00:00:00.000'dt;
and now EffectiveWithdrawData is a SAS date/time value, which is numeric.
By the way, if you want a variable to be numeric and have length of 8, you don't have to do anything, 8 is the default.
EffectiveWithdrawDate = '15APR2015:00:00:00.000';
makes EffectiveWithdrawData a character string. It should be
EffectiveWithdrawDate = '15APR2015:00:00:00.000'dt;
and now EffectiveWithdrawData is a SAS date/time value, which is numeric.
By the way, if you want a variable to be numeric and have length of 8, you don't have to do anything, 8 is the default.
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!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.