You may want to repost your example data in a code box opened by using the forum {i} menu icon.
as posted when I copy the data to a text file your column 23 has the letter B for the first data record which is not valid for the TEMP variable as numeric.
Sometimes the forum main window "helps" by reformatting text and may have removed sequential spaces or possibly tabs.
This may be a starting example. I reformatted the data in the editor to better match the input descriptions. The numerics are defaulting to best. formats which look like integers.
data read;
input @@;
if substr(_infile_,1,1)="#" then
input
HEADREC $ 1
ID $ 2- 12
YEAR 14- 17
MONTH 19- 20
DAY 22- 23
HOUR 25- 26
RELTIME 28- 31
NUMLEV 33- 36
P_SRC $ 38- 45
NP_SRC $ 47- 54
LAT 56- 62
LON 64- 71
;
else input
LVLTYP1 1
LVLTYP2 2
ETIME 4- 8
PRESS 10- 15
PFLAG $ 16- 16
GPH 17
rZFLAG $ 22- 22
TEMP 23- 27
TFLAG $ 28- 28
RH 29- 33
DPDP 35- 39
WDIR 41- 45
WSPD 47- 51
;
datetime=dhms(mdy(month,day,year),hour,0,0);
format datetime datetime16.;
datalines;
#CAM00071109 1952 10 31 03 9999 14 ncar-ccd 506850 -1273758
21 -9999 101400B 19 72B 933 -9999 -9999 -9999
10 -9999 100000 134B 72B 933 -9999 -9999 -9999
10 -9999 85000 1439B -8B 863 -9999 -9999 -9999
10 -9999 70000 2978B -102B 748 -9999 -9999 -9999
20 -9999 57600 -9999 -208B 838 -9999 -9999 -9999
20 -9999 55000 -9999 -235B 614 -9999 -9999 -9999
10 -9999 50000 5480B -278B 596 -9999 -9999 -9999
10 -9999 40000 7041B -405B 671 -9999 -9999 -9999
10 -9999 30000 8955B -505B-9999 -9999 -9999 -9999
20 -9999 27300 -9999 -530A-9999 -9999 -9999 -9999
10 -9999 20000 11595B -482B-9999 -9999 -9999 -9999
10 -9999 15000 13481B -502A-9999 -9999 -9999 -9999
10 -9999 10000 16142B -505A-9999 -9999 -9999 -9999
20 -9999 6200 -9999 -530A-9999 -9999 -9999 -9999
;
run;
If you want the values from the header record to be one the data records add a RETAIN statement listing the header variables of interest. I also created a datetime variable as putting date/time information together is often better than the separate fields. Note though that if any of the incoming values are not valid dates, ie month=2 and day=31, then the datetime is going to through an error about invalid date.
... View more