Help using Base SAS procedures

Using line pointer controls with input statement

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 9
Accepted Solution

Using line pointer controls with input statement

With my code I am having a missing value on Salary column. I am trying to understand why?

data sales_staff2;
     infile "&path/sales2.dat";
     input    Employee_ID 6.   @21 Last_Name $ 18. /
              Job_Title $ 20.  @22 Hire_Date mmddyy10. /
              @ 33 Salary dollar8. ;
              
           
run;
title 'Australian and US Sales Staff';
proc print data=sales_staff2;
run;

 

This is the partial result :

 

Australian and US Sales Staff

 Obs Employee_ID Last_Name Job_Title Hire_Date Salary1234567 

120102ZhouSales Manager12205.
120103DawesSales Manager6575.
120121ElvishSales Rep. II6575.
120122NganSales Rep. II8217.
120123HotstoneSales Rep. I18901.
120124DaymondSales Rep. I18687.
120125HofmeisterSales Rep. IV8460

.

 

     
The i
nformation for each employee is
in three lines of raw data. The record layouts are shown below:
Line 1 layout
Field
Description
Starting
Column
Length o
f
Field
Data Type
Employee ID
1
6
Numeric
First Name
8
12
Character
Last Name
21
18
Character
Line 2 layout
Field
Description
Starting
Column
Length of
Field
Data Type
Job Title
1
20
Character
Hire Date
22
10
Numeric
mm/dd/yyyy
Salary
33
8
Numeric
Say,
$100,000
 

Accepted Solutions
Solution
‎11-10-2017 03:04 PM
New Contributor
Posts: 3

Re: Using line pointer controls with input statement

The raw data has 3 lines of code! You will need the #3 even if there is no data to read in.

 

data sales_staff2;
     infile "&path/sales2.dat";
     input   #1  Employee_ID 6.   @21 Last_Name $ 18. 
                #2   Job_Title $ 20.    @22 Hire_Date mmddyy10.   @ 33 Salary dollar8.

                #3 ;

     run;

 

and use the termstr option if the raw data is a Unix file.

 

 

View solution in original post


All Replies
Super User
Super User
Posts: 8,120

Re: Using line pointer controls with input statement

If you had posted the SAS log we could have looked at the notes and helped you debug this. Also you should have posted example lines from the data file into the Insert Code pop-up box (to prevent it being formatted into paragraphs).

 

A couple of possible things to check.

 

If the value of the salary was less than 8 characters then because you did not include TRUNCOVER option on your INFILE statement SAS would have tried to find 8 characters for it by going to the next line. You would have seen a note to that effect.

 

It is possible you are reading a file from a PC on a UNIX system and the salary value is followed by a Carriage Return character which the informat does not understand.  You should have seen notes about invalid value in the log You might need to add TERMSTR=CRLF to your INFILE statement if that is case.

Occasional Contributor
Posts: 9

Re: Using line pointer controls with input statement

Hi Tom.

Thanks for helping. In fact the log mentions no error as you can see below.

SAS Studio

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
61
62 data sales_staff2;
63 infile "&path/sales2.dat";
64 input Employee_ID 6. @21 Last_Name $ 18. /
65 Job_Title $ 20. @22 Hire_Date mmddyy10./
66 @ 33 Salary dollar8. ;
67
68
69 run;
 
NOTE: The infile "/folders/myfolders//sales2.dat" is:
Filename=/folders/myfolders//sales2.dat,
Owner Name=root,Group Name=vboxsf,
Access Permission=-rwxrwx---,
Last Modified=21Oct2017:11:34:28,
File Size (bytes)=40095
 
NOTE: 495 records were read from the infile "/folders/myfolders//sales2.dat".
The minimum record length was 80.
The maximum record length was 80.
NOTE: The data set WORK.SALES_STAFF2 has 165 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
 
70 title 'Australian and US Sales Staff';
71 proc print data=sales_staff2;
72 run;
 
NOTE: There were 165 observations read from the data set WORK.SALES_STAFF2.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.26 seconds
cpu time 0.27 seconds
 
 
73
74 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
87
Download results as an HTML fileDownload results as a PDF fileDownload results as an RTF fileDownload generated data
 
Print results
 
Open in a new browser tab
 
Maximize view
+Table of Contents
 
 
-
- The PRINT Procedure
* Data Set WORK.SALES_STAFF2
 
Results: exo204fo2
Results: exo204fo2

Australian and US Sales Staff

The PRINT Procedure Data Set WORK.SALES_STAFF2 Obs Employee_ID Last_Name Job_Title Hire_Date Salary123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
120102ZhouSales Manager12205.
120103DawesSales Manager6575.
120121ElvishSales Rep. II6575.
120122NganSales Rep. II8217.
120123HotstoneSales Rep. I18901.
120124DaymondSales Rep. I18687.
120125HofmeisterSales Rep. IV8460.
120126DennySales Rep. II18475.
120127ClarksonSales Rep. II15645.
120128KletschkusSales Rep. IV18567.
120129RoebuckSales Rep. III10866.
120130LyonSales Rep. I18748.
120131SurawskiSales Rep. I18628.
120132KaiserSales Rep. III8309.
120133SoltauSales Rep. II18536.
120134ShannanSales Rep. II6575.
120135PlattsSales Rep. IV15249.
120136LeydenSales Rep. I18659.
120137IyengarSales Rep. III18322.
120138DuckettSales Rep. I18809.
120139WilsonSales Rep. II18506.
120140MinasSales Rep. I18901.
120141LiebmanSales Rep. II18383.
120142EastleySales Rep. III18444.
120143SloeySales Rep. II9770.
120144BarbisSales Rep. III18536.
120145AisbittSales Rep. II10744.
120146CederlundSales Rep. I18840.
120147RusliSales Rep. II18536.
120148ZubakSales Rep. III8187.
120149ChantharasySales Rep. I18628.
120150FiloSales Rep. III9709.
120151PhaiyakounhSales Rep. II6575.
120152DivesSales Rep. I18718.
120153WaalSales Rep. I18628.
120154HayawardhanaSales Rep. III6575.
120155JamesSales Rep. III18353.
120156SnellingsSales Rep. I18687.
120157KaravdicSales Rep. II18597.
120158PilgrimSales Rep. III11504.
120159PhoumirathSales Rep. IV11139.
120160SegraveSales Rep. I18901.
120161MartinesSales Rep. III18536.
120162ScordiaSales Rep. I18659.
120163MagrathSales Rep. II12784.
120164StamalisSales Rep. II9528.
120165PretoriusSales Rep. I18687.
120166NowdSales Rep. IV6575.
120167TilleySales Rep. I18659.
120168BarcoeSales Rep. I18932.
120169TannousSales Rep. III18383.
120170KingstonSales Rep. III13423.
120171MoodySales Rep. II18506.
120172ComberSales Rep. III6575.
120173OsbornSales Rep. I18779.
120174SimmsSales Rep. I18628.
120175ConollySales Rep. I18901.
120176PaSales Rep. I18932.
120177KierceSales Rep. III15372.
120178PlestedSales Rep. II6665.
120179WillsSales Rep. III17532.
120180GeorgeSales Rep. II8370.
120198BodySales Rep. III18597.
120261HighpointChief Sales Officer11535.
121018MagolanSales Rep. II6575.
121019DesanctisSales Rep. IV17684.
121020RidleySales Rep. IV16922.
121021FarrenSales Rep. IV13939.
121022StevensSales Rep. IV16833.
121023FullerSales Rep. I18748.
121024WestlundSales Rep. II17653.
121025CasseySales Rep. II7183.
121026JaimeSales Rep. IV18353.
121027RudderSales Rep. II12388.
121028SmadesSales Rep. I18932.
121029McelweeSales Rep. I18962.
121030AreuSales Rep. I18659.
121031FilanSales Rep. III10805.
121032SmithSales Rep. IV18322.
121033SnitzerSales Rep. III17684.
121034KirkmanSales Rep. II18628.
121035BlackleySales Rep. II6575.
121036MesleySales Rep. I18901.
121037MiketaSales Rep. III16861.
121038AnsteySales Rep. I18840.
121039WashingtonSales Rep. II8887.
121040DarrohnSales Rep. III9801.
121041WetheringtonSales Rep. II6575.
121042Robbin-CokerSales Rep. III16010.
121043KagariseSales Rep. II13209.
121044AbbottSales Rep. I18840.
121045HamptonSales Rep. II13880.
121046MandzakSales Rep. I18809.
121047GrzebienSales Rep. I18871.
121048ClarkSales Rep. I18871.
121049BatainehSales Rep. I18962.
121050Capristo-AbramczykSales Rep. II18597.
121051MyersSales Rep. I18932.
121052FaySales Rep. II18567.
121053McdadeSales Rep. III6606.
121054PulliamSales Rep. III7610.
121055DavisSales Rep. III18475.
121056LyszykSales Rep. II17287.
121057VoronSales Rep. I18962.
121058KohakeSales Rep. I18901.
121059CarhideSales Rep. II9222.
121060SpoffordSales Rep. III6575.
121061HassamSales Rep. III10409.
121062ArmantSales Rep. IV18475.
121063KinolSales Rep. II18110.
121064PolkySales Rep. I18871.
121065MaltaSales Rep. III18353.
121066NormanSales Rep. II6575.
121067MacnairSales Rep. IV18322.
121068OsubaSales Rep. II13393.
121069LapsleySales Rep. II12692.
121070HolthouseSales Rep. III18294.
121071HoppmannSales Rep. III7914.
121072NorthSales Rep. I18871.
121073CourtSales Rep. I18628.
121074MichonskiSales Rep. I18901.
121075SuggSales Rep. II6575.
121076CobbSales Rep. II9862.
121077SmotherlySales Rep. III18536.
121078WendeSales Rep. I18932.
121079MeesSales Rep. I18932.
121080ChinnisSales Rep. I18871.
121081KnudsonSales Rep. III7396.
121082DebankSales Rep. III7944.
121083SuttonSales Rep. I18687.
121084OuldSales Rep. I18628.
121085HuslageSales Rep. IV18628.
121086PlybonSales Rep. I18628.
121087O'SuilleabhainSales Rep. II15765.
121088KernitzkiSales Rep. I18628.
121089SauderSales Rep. II6756.
121090KlibbeSales Rep. I18659.
121091KadiriSales Rep. II12054.
121092PrittSales Rep. I18840.
121093VasconcellosSales Rep. I18628.
121094TateSales Rep. I18871.
121095KratzkeSales Rep. II12965.
121096NewsteadSales Rep. I18748.
121097ChernegaSales Rep. II14518.
121098HeatwoleSales Rep. I18748.
121099MrvichinSales Rep. IV16192.
121100CormellSales Rep. II7396.
121101BucknerSales Rep. I18932.
121102FlammiaSales Rep. I18779.
121103FarnsworthSales Rep. I18871.
121104JohnsonSales Rep. II11048.
121105SavacoolSales Rep. III17167.
121106HilburgerSales Rep. I18659.
121107AngerSales Rep. IV18444.
121108LeviSales Rep. I18932.
121109BoulusSales Rep. I18748.
121135RutaSales Rep. I18840.
121136GalarneauSales Rep. I18962.
121137BoocksSales Rep. I18718.
121138TolleySales Rep. I18628.
121139MckeeSales Rep. II11504.
121140BriggiSales Rep. I18718.
121143FavaronSenior Sales Manager15157.
121144CapachiettiSales Manager13088.
121145LansberrySales Manager7396.
 
Table:
WORK.SALES_STAFF2
 
 
View:
Column names
 
 
Open a new file and display the code that creates the current table.Print tableRefresh table dataTable properties
 
Filter: (none)
 
X
Columns
Select all Select all
 
Employee_IDEmployee_ID
Last_NameLast_Name
Job_TitleJob_Title
Hire_DateHire_Date
SalarySalary
 
 
 
 
Property Value
Label 
Name 
Length 
Type 
Format 
Informat 
 
 
Rows 1-100Previous page of table
Total rows: 165Total columns: 5
 Employee_ID
 
Last_Name
 
Job_Title
 
Hire_Date
 
Salary
 
 
1120102ZhouSales Manager12205. 
2120103DawesSales Manager6575. 
3120121ElvishSales Rep. II6575. 
4120122NganSales Rep. II8217. 
5120123HotstoneSales Rep. I18901. 
6120124DaymondSales Rep. I18687. 
7120125HofmeisterSales Rep. IV8460. 
8120126DennySales Rep. II18475. 
9120127ClarksonSales Rep. II15645. 
10120128KletschkusSales Rep. IV18567. 
11120129RoebuckSales Rep. III10866. 
12120130LyonSales Rep. I18748. 
13120131SurawskiSales Rep. I18628. 
14120132KaiserSales Rep. III8309. 
15120133SoltauSales Rep. II18536. 
16120134ShannanSales Rep. II6575. 
17120135PlattsSales Rep. IV15249. 
18120136LeydenSales Rep. I18659. 
19120137IyengarSales Rep. III18322. 
20120138DuckettSales Rep. I18809. 
21120139WilsonSales Rep. II18506. 
22120140MinasSales Rep. I18901. 
23120141LiebmanSales Rep. II18383. 
24120142EastleySales Rep. III18444. 
25120143SloeySales Rep. II9770. 
26120144BarbisSales Rep. III18536. 
27120145AisbittSales Rep. II10744. 
28120146CederlundSales Rep. I18840. 
29120147RusliSales Rep. II18536. 
30120148ZubakSales Rep. III8187. 
31120149ChantharasySales Rep. I18628. 
32120150FiloSales Rep. III9709. 
33120151PhaiyakounhSales Rep. II6575. 
34120152DivesSales Rep. I18718. 
35120153WaalSales Rep. I18628. 
36120154HayawardhanaSales Rep. III6575. 
37120155JamesSales Rep. III18353. 
38120156SnellingsSales Rep. I18687. 
39120157KaravdicSales Rep. II18597. 
40120158PilgrimSales Rep. III11504. 
41120159PhoumirathSales Rep. IV11139. 
42120160SegraveSales Rep. I18901. 
43120161MartinesSales Rep. III18536. 
44120162ScordiaSales Rep. I18659. 
45120163MagrathSales Rep. II12784. 
46120164StamalisSales Rep. II9528. 
47120165PretoriusSales Rep. I18687. 
48120166NowdSales Rep. IV6575. 
49120167TilleySales Rep. I18659. 
50120168BarcoeSales Rep. I18932. 
51120169TannousSales Rep. III18383. 
52120170KingstonSales Rep. III13423. 
53120171MoodySales Rep. II18506. 
54120172ComberSales Rep. III6575. 
55120173OsbornSales Rep. I18779. 
56120174SimmsSales Rep. I18628. 
57120175ConollySales Rep. I18901. 
58120176PaSales Rep. I18932. 
59120177KierceSales Rep. III15372. 
60120178PlestedSales Rep. II6665. 
61120179WillsSales Rep. III17532. 
62120180GeorgeSales Rep. II8370. 
63120198BodySales Rep. III18597. 
64120261HighpointChief Sales Officer11535. 
65121018MagolanSales Rep. II6575. 
66121019DesanctisSales Rep. IV17684. 
67121020RidleySales Rep. IV16922. 
68121021FarrenSales Rep. IV13939. 
69121022StevensSales Rep. IV16833. 
70121023FullerSales Rep. I18748. 
71121024WestlundSales Rep. II17653. 
72121025CasseySales Rep. II7183. 
73121026JaimeSales Rep. IV18353. 
74121027RudderSales Rep. II12388. 
75121028SmadesSales Rep. I18932. 
76121029McelweeSales Rep. I18962. 
77121030AreuSales Rep. I18659. 
78121031FilanSales Rep. III10805. 
79121032SmithSales Rep. IV18322. 
80121033SnitzerSales Rep. III17684. 
81121034KirkmanSales Rep. II18628. 
82121035BlackleySales Rep. II6575. 
83121036MesleySales Rep. I18901. 
84121037MiketaSales Rep. III16861. 
85121038AnsteySales Rep. I18840. 
86121039WashingtonSales Rep. II8887. 
87121040DarrohnSales Rep. III9801. 
88121041WetheringtonSales Rep. II6575. 
89121042Robbin-CokerSales Rep. III16010. 
90121043KagariseSales Rep. II13209. 
91121044AbbottSales Rep. I18840. 
92121045HamptonSales Rep. II13880. 
93121046MandzakSales Rep. I18809. 
94121047GrzebienSales Rep. I18871. 
95121048ClarkSales Rep. I18871. 
96121049BatainehSales Rep. I18962. 
97121050Capristo-AbramczykSales Rep. II18597. 
98121051MyersSales Rep. I18932. 
99121052FaySales Rep. II18567. 
100121053McdadeSales Rep. III6606. 
 
 
 
Occasional Contributor
Posts: 9

Re: Using line pointer controls with input statement

Hi.

Here is the log:

 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
61
62 data sales_staff2;
63 infile "&path/sales2.dat";
64 input Employee_ID 1-6 @21 Last_Name $ 18. /
65 Job_Title $ 1-20 @22 Hire_Date mmddyy10. @ 33 Salary dollar8. ;
66
67
68 run;
 
NOTE: The infile "/folders/myfolders//sales2.dat" is:
Filename=/folders/myfolders//sales2.dat,
Owner Name=root,Group Name=vboxsf,
Access Permission=-rwxrwx---,
Last Modified=21Oct2017:11:34:28,
File Size (bytes)=40095
 
NOTE: Invalid data for Employee_ID in line 3 1-6.
NOTE: Invalid data for Hire_Date in line 4 22-31.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
4 120103 Wilson Dawes 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name= Job_Title=120103 Wilson Hire_Date=. Salary=. _ERROR_=1 _N_=2
NOTE: Invalid data for Employee_ID in line 5 1-6.
6 M 01/22/1953 AU 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name=01/01/1978 $87,9 Job_Title=M 01/22/1953 AU Hire_Date=. Salary=. _ERROR_=1 _N_=3
NOTE: Invalid data for Employee_ID in line 9 1-6.
NOTE: Invalid data for Hire_Date in line 10 22-31.
10 120122 Christina Ngan 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name= Job_Title=120122 Christina Hire_Date=. Salary=. _ERROR_=1 _N_=5
NOTE: Invalid data for Employee_ID in line 11 1-6.
12 F 07/27/1958 AU 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name=07/01/1982 $27,4 Job_Title=F 07/27/1958 AU Hire_Date=. Salary=. _ERROR_=1 _N_=6
NOTE: Invalid data for Employee_ID in line 15 1-6.
NOTE: Invalid data for Hire_Date in line 16 22-31.
16 120124 Lucian Daymond 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name= Job_Title=120124 Lucian Hire_Date=. Salary=. _ERROR_=1 _N_=8
NOTE: Invalid data for Employee_ID in line 17 1-6.
18 M 05/13/1963 AU 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name=03/01/2011 $26,4 Job_Title=M 05/13/1963 AU Hire_Date=. Salary=. _ERROR_=1 _N_=9
NOTE: Invalid data for Employee_ID in line 21 1-6.
NOTE: Invalid data for Hire_Date in line 22 22-31.
22 120126 Satyakam Denny 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name= Job_Title=120126 Satyakam Hire_Date=. Salary=. _ERROR_=1 _N_=11
NOTE: Invalid data for Employee_ID in line 23 1-6.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
24 M 09/20/1992 AU 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name=08/01/2010 $26,7 Job_Title=M 09/20/1992 AU Hire_Date=. Salary=. _ERROR_=1 _N_=12
NOTE: Invalid data for Employee_ID in line 27 1-6.
NOTE: Invalid data for Hire_Date in line 28 22-31.
28 120128 Monica Kletschkus 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name= Job_Title=120128 Monica Hire_Date=. Salary=. _ERROR_=1 _N_=14
NOTE: Invalid data for Employee_ID in line 29 1-6.
30 F 07/14/1990 AU 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name=11/01/2010 $30,8 Job_Title=F 07/14/1990 AU Hire_Date=. Salary=. _ERROR_=1 _N_=15
NOTE: Invalid data for Employee_ID in line 33 1-6.
NOTE: Invalid data for Hire_Date in line 34 22-31.
34 120130 Kevin Lyon 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name= Job_Title=120130 Kevin Hire_Date=. Salary=. _ERROR_=1 _N_=17
NOTE: Invalid data for Employee_ID in line 35 1-6.
36 M 12/14/1988 AU 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name=05/01/2011 $26,9 Job_Title=M 12/14/1988 AU Hire_Date=. Salary=. _ERROR_=1 _N_=18
NOTE: Invalid data for Employee_ID in line 39 1-6.
NOTE: Invalid data for Hire_Date in line 40 22-31.
40 120132 Fancine Kaiser 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name= Job_Title=120132 Fancine Hire_Date=. Salary=. _ERROR_=1 _N_=20
NOTE: Invalid data for Employee_ID in line 41 1-6.
42 F 04/05/1953 AU 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name=10/01/1982 $28,5 Job_Title=F 04/05/1953 AU Hire_Date=. Salary=. _ERROR_=1 _N_=21
NOTE: Invalid data for Employee_ID in line 45 1-6.
NOTE: Invalid data for Hire_Date in line 46 22-31.
46 120134 Sian Shannan 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name= Job_Title=120134 Sian Hire_Date=. Salary=. _ERROR_=1 _N_=23
NOTE: Invalid data for Employee_ID in line 47 1-6.
48 M 06/06/1953 AU 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name=01/01/1978 $28,0 Job_Title=M 06/06/1953 AU Hire_Date=. Salary=. _ERROR_=1 _N_=24
NOTE: Invalid data for Employee_ID in line 51 1-6.
NOTE: Invalid data for Hire_Date in line 52 22-31.
52 120136 Atul Leyden 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name= Job_Title=120136 Atul Hire_Date=. Salary=. _ERROR_=1 _N_=26
NOTE: Invalid data for Employee_ID in line 53 1-6.
54 M 09/16/1983 AU 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name=02/01/2011 $26,6 Job_Title=M 09/16/1983 AU Hire_Date=. Salary=. _ERROR_=1 _N_=27
NOTE: Invalid data for Employee_ID in line 57 1-6.
NOTE: Invalid data for Hire_Date in line 58 22-31.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
58 120138 Shani Duckett 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name= Job_Title=120138 Shani Hire_Date=. Salary=. _ERROR_=1 _N_=29
NOTE: Invalid data for Employee_ID in line 59 1-6.
WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed.
60 F 07/11/1983 AU 80
NOTE: Invalid data errors for file '"/folders/myfolders//sales2.dat"' occurred outside the printed range.
NOTE: Increase available buffer lines with the INFILE n= option.
Employee_ID=. Last_Name=07/01/2011 $25,7 Job_Title=F 07/11/1983 AU Hire_Date=. Salary=. _ERROR_=1 _N_=30
NOTE: LOST CARD.
NOTE: 495 records were read from the infile "/folders/myfolders//sales2.dat".
The minimum record length was 80.
The maximum record length was 80.
NOTE: The data set WORK.SALES_STAFF2 has 247 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
 
 
69 title 'Australian and US Sales Staff';
70 proc print data=sales_staff2;
71 run;
 
NOTE: There were 247 observations read from the data set WORK.SALES_STAFF2.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.39 seconds
cpu time 0.40 seconds
 
 
72
73
74 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
87
Super User
Posts: 13,583

Re: Using line pointer controls with input statement

Your very hard to read and follow data layout does not mention a line three so you probably don't actually want that second / on the input statement.

 

Post some example data in a code box opened using the forum menu {I} icon so we can see plain text as read by the infile statement.

Replace any sensitive values such as names with dummy values if needed but keep the same format.

New Contributor
Posts: 3

Re: Using line pointer controls with input statement

In your code you are reading 3 lines of data not 2. The second "/" is unnecessary. The second line holds Job Title, HireDate and Salary.

You may prefer to use input #1 for line1 and #2 for line 2.

 

eg.

data sales_staff2;
     infile "&path/sales2.dat";
     input   #1  Employee_ID 6.   @21 Last_Name $ 18. 
                #2   Job_Title $ 20.    @22 Hire_Date mmddyy10.   @ 33 Salary dollar8. ;

     run;

Occasional Contributor
Posts: 9

Re: Using line pointer controls with input statement

Posted in reply to Sue-Little

Hi Sue.

Here is the revised code:

data sales_staff2;
     infile "&path/sales2.dat";
     input  #1  Employee_ID 6.   @21 Last_Name $ 18. /                      
            #2  Job_Title $ 20.  @22 Hire_Date mmddyy10. @ 33 Salary dollar8. ;
              
           
run;
title 'Australian and US Sales Staff';
proc print data=sales_staff2;
run;

The result is not quiet there yet:

Australian and US Sales Staff

 Obs Employee_ID Last_Name Job_Title Hire_Date Salary123456789101112

120102ZhouSales Manager12205108255
. 120103 Wilson..
.01/01/1978 $87,9M 01/22/1953 AU..
120121ElvishSales Rep. II657526600
. 120122 Christina..
.07/01/1982 $27,4F 07/27/1958 AU..
120123HotstoneSales Rep. I1890126190
. 120124 Lucian..
.03/01/2011 $26,4M 05/13/1963 AU..
120125HofmeisterSales Rep. IV846032040
. 120126 Satyakam..
.08/01/2010 $26,7M 09/20/1992 AU..
New Contributor
Posts: 3

Re: Using line pointer controls with input statement

Sorry the "/" is no longer needed with the #line numbering.

 

Do you have a sample of the raw data because this would help. Needn't be the "live" data - make something up!

Occasional Contributor
Posts: 9

Re: Using line pointer controls with input statement

Posted in reply to Sue-Little

I do not have a sample of the raw data. But the partial proc print output is shown.

Partial PROC PRINT Output (165 Total Observations)
Australian and US Sales Staff
Employee_
Hire_
ID Last_Name Job_Title
Date Salary
120102 Zhou Sales Manager 12205 108255
120103 Dawes Sales Manager 6575 87975
120121 Elvish Sales Rep. II 6575 26600
120122 Ngan Sales Rep. II 8217 27475
120123 Hotstone Sales Rep. I 18901 26190
Super User
Posts: 13,583

Re: Using line pointer controls with input statement

You likely want to add a date format for the date variable so you can see if your values are as need. I suggest adding:

 

Format date date9. ;

 


Gillo wrote:

I do not have a sample of the raw data. But the partial proc print output is shown.

 

Pretty obviously not quite accurate. The raw data is in the file your are reading. If you don't have access to that file how are you reading it?

Copy and paste 8 lines or so from the start of the file and paste into the code box as mentioned.

Occasional Contributor
Posts: 9

Re: Using line pointer controls with input statement

[ Edited ]

Hi.

Here below is a copy of the raw data.

Edited to place the data into a code box so that formatting is not lost.      

120102 Tom          Zhou                                                        
Sales Manager        06/01/1993 $108,255                                        
M 08/11/1973 AU                                                                 
120103 Wilson       Dawes                                                       
Sales Manager        01/01/1978  $87,975                                        
M 01/22/1953 AU                                                                 
120121 Irenie       Elvish                                                      
Sales Rep. II        01/01/1978  $26,600                                        
F 08/02/1948 AU                                                                 
120122 Christina    Ngan                                                        
Sales Rep. II        07/01/1982  $27,475                                        
F 07/27/1958 AU                                                                 
120123 Kimiko       Hotstone                                                    
Sales Rep. I         10/01/2011  $26,190                                        
F 09/28/1968 AU                                                                 
120124 Lucian       Daymond                                                     
Sales Rep. I         03/01/2011  $26,480                                        
M 05/13/1963 AU                                                                 
120125 Fong         Hofmeister                                                  
Sales Rep. IV        03/01/1983  $32,040                                        
M 12/06/1958 AU                                                                 
120126 Satyakam     Denny                                                       
Sales Rep. II        08/01/2010  $26,780                                        
M 09/20/1992 AU                                                                 
120127 Sharryn      Clarkson                                                    
Sales Rep. II        11/01/2002  $28,100                                        
F 01/04/1983 AU                                                                 
120128 Monica       Kletschkus                                                  
Sales Rep. IV        11/01/2010  $30,890                                        
F 07/14/1990 AU                                                                 
120129 Alvin        Roebuck                                                     
Sales Rep. III       10/01/1989  $30,070                                        
M 11/22/1968 AU                                                                 
120130 Kevin        Lyon                                                        
Sales Rep. I         05/01/2011  $26,955                                        
M 12/14/1988 AU                                                                 
120131 Marinus      Surawski                                                    
Sales Rep. I         01/01/2011  $26,910                                        
M 09/25/1983 AU                                                                 
120132 Fancine      Kaiser                                                      
Sales Rep. III       10/01/1982  $28,525                                        
F 04/05/1953 AU                                                                 
120133 Petrea       Soltau                                                      
Sales Rep. II        10/01/2010  $27,440                                        
F 04/22/1990 AU                                                                 
120134 Sian         Shannan                                                     
Sales Rep. II        01/01/1978  $28,015                                        
M 06/06/1953 AU                                                                 
120135 Alexei       Platts                                                      
Sales Rep. IV        10/01/2001  $32,490                                        
M 01/26/1973 AU                                                                 
120136 Atul         Leyden                                                      
Sales Rep. I         02/01/2011  $26,605                                        
M 09/16/1983 AU                                                                 
120137 Marina       Iyengar                                                     
Sales Rep. III       03/01/2010  $29,715                                        
F 03/12/1983 AU                                                                 
120138 Shani        Duckett                                                     
Sales Rep. I         07/01/2011  $25,795                                        
F 07/11/1983 AU                                                                 
120139 Fang         Wilson                                                      
Sales Rep. II        09/01/2010  $26,810                                        
F 08/18/1990 AU                                                                 
120140 Michael      Minas                                                       
Sales Rep. I         10/01/2011  $26,970                                        
M 08/03/1992 AU                                                                 
120141 Amanda       Liebman                                                     
Sales Rep. II        05/01/2010  $27,465                                        
F 03/12/1992 AU                                                                 
120142 Vincent      Eastley                                                     
Sales Rep. III       07/01/2010  $29,695                                        
M 06/14/1990 AU                                                                 
120143 Phu          Sloey                                                       
Sales Rep. II        10/01/1986  $26,790                                        
M 05/17/1963 AU                                                                 
120144 Viney        Barbis                                                      
Sales Rep. III       10/01/2010  $30,265                                        
M 03/07/1990 AU                                                                 
120145 Sandy        Aisbitt                                                     
Sales Rep. II        06/01/1989  $26,060                                        
M 01/22/1968 AU                                                                 
120146 Wendall      Cederlund                                                   
Sales Rep. I         08/01/2011  $25,985                                        
M 10/02/1963 AU                                                                 
120147 Skev         Rusli                                                       
Sales Rep. II        10/01/2010  $26,580                                        
F 01/19/1992 AU                                                                 
120148 Michael      Zubak                                                       
Sales Rep. III       06/01/1982  $28,480                                        
M 09/13/1953 AU                                                                 
120149 Judy         Chantharasy                                                 
Sales Rep. I         01/01/2011  $26,390                                        
F 11/21/1978 AU                                                                 
120150 John         Filo                                                        
Sales Rep. III       08/01/1986  $29,965                                        
M 07/09/1958 AU                                                                 
120151 Julianna     Phaiyakounh                                                 
Sales Rep. II        01/01/1978  $26,520                                        
F 11/21/1948 AU                                                                 
120152 Sean         Dives                                                       
Sales Rep. I         04/01/2011  $26,515                                        
M 05/01/1983 AU                                                                 
120153 Samantha     Waal                                                        
Sales Rep. I         01/01/2011  $27,260                                        
F 05/07/1983 AU                                                                 
120154 Caterina     Hayawardhana                                                
Sales Rep. III       01/01/1978  $30,490                                        
F 07/20/1948 AU                                                                 
120155 Narelle      James                                                       
Sales Rep. III       04/01/2010  $29,990                                        
F 04/22/1988 AU                                                                 
120156 Gerry        Snellings                                                   
Sales Rep. I         03/01/2011  $26,445                                        
F 09/01/1992 AU                                                                 
120157 Leonid       Karavdic                                                    
Sales Rep. II        12/01/2010  $27,860                                        
M 02/21/1990 AU                                                                 
120158 Daniel       Pilgrim                                                     
Sales Rep. III       07/01/1991  $36,605                                        
M 07/14/1968 AU                                                                 
120159 Lynelle      Phoumirath                                                  
Sales Rep. IV        07/01/1990  $30,765                                        
F 02/24/1968 AU                                                                 
120160 Chuck        Segrave                                                     
Sales Rep. I         10/01/2011  $27,115                                        
M 09/09/1958 AU                                                                 
120161 Rosette      Martines                                                    
Sales Rep. III       10/01/2010  $30,785                                        
F 03/07/1992 AU                                                                 
120162 Randal       Scordia                                                     
Sales Rep. I         02/01/2011  $27,215                                        
M 09/05/1992 AU                                                                 
120163 Brett        Magrath                                                     
Sales Rep. II        01/01/1995  $26,735                                        
M 05/22/1968 AU                                                                 
120164 Ranj         Stamalis                                                    
Sales Rep. II        02/01/1986  $27,450                                        
F 11/26/1963 AU                                                                 
120165 Tadashi      Pretorius                                                   
Sales Rep. I         03/01/2011  $27,050                                        
M 03/19/1988 AU                                                                 
120166 Fadi         Nowd                                                        
Sales Rep. IV        01/01/1978  $30,660                                        
M 06/14/1948 AU                                                                 
120167 Kimiko       Tilley                                                      
Sales Rep. I         02/01/2011  $25,185                                        
F 05/04/1958 AU                                                                 
120168 Selina       Barcoe                                                      
Sales Rep. I         11/01/2011  $25,275                                        
F 03/24/1988 AU                                                                 
120169 Cos          Tannous                                                     
Sales Rep. III       05/01/2010  $28,135                                        
M 01/02/1988 AU                                                                 
120170 Alban        Kingston                                                    
Sales Rep. III       10/01/1996  $28,830                                        
M 02/25/1978 AU                                                                 
120171 Alena        Moody                                                       
Sales Rep. II        09/01/2010  $26,205                                        
F 07/19/1988 AU                                                                 
120172 Edwin        Comber                                                      
Sales Rep. III       01/01/1978  $28,345                                        
M 04/01/1948 AU                                                                 
120173 Hernani      Osborn                                                      
Sales Rep. I         06/01/2011  $26,715                                        
M 02/23/1958 AU                                                                 
120174 Doungkamol   Simms                                                       
Sales Rep. I         01/01/2011  $26,850                                        
F 01/10/1948 AU                                                                 
120175 Andrew       Conolly                                                     
Sales Rep. I         10/01/2011  $25,745                                        
M 08/18/1992 AU                                                                 
120176 Koavea       Pa                                                          
Sales Rep. I         11/01/2011  $26,095                                        
M 11/09/1990 AU                                                                 
120177 Franca       Kierce                                                      
Sales Rep. III       02/01/2002  $28,745                                        
F 04/05/1983 AU                                                                 
120178 Billy        Plested                                                     
Sales Rep. II        04/01/1978  $26,165                                        
M 11/23/1958 AU                                                                 
120179 Matsuoka     Wills                                                       
Sales Rep. III       01/01/2008  $28,510                                        
M 03/15/1978 AU                                                                 
120180 Vino         George                                                      
Sales Rep. II        12/01/1982  $26,970                                        
M 06/27/1958 AU                                                                 
120198 Meera        Body                                                        
Sales Rep. III       12/01/2010  $28,025                                        
F 01/21/1992 AU                                                                 
120261 Harry        Highpoint                                                   
Chief Sales Officer  08/01/1991 $243,190                                        
M 02/21/1973 US                                                                 
121018 Julienne     Magolan                                                     
Sales Rep. II        01/01/1978  $27,560                                        
F 01/03/1948 US                                                                 
121019 Scott        Desanctis                                                   
Sales Rep. IV        06/01/2008  $31,320                                        
M 06/25/1990 US                                                                 
121020 Cherda       Ridley                                                      
Sales Rep. IV        05/01/2006  $31,750                                        
F 02/23/1988 US                                                                 
121021 Priscilla    Farren                                                      
Sales Rep. IV        03/01/1998  $32,985                                        
F 12/10/1978 US                                                                 
121022 Robert       Stevens                                                     
Sales Rep. IV        02/01/2006  $32,210                                        
M 10/28/1983 US                                                                 
121023 Shawn        Fuller                                                      
Sales Rep. I         05/01/2011  $26,010                                        
M 03/13/1968 US                                                                 
121024 Michael      Westlund                                                    
Sales Rep. II        05/01/2008  $26,600                                        
M 09/21/1988 US                                                                 
121025 Barnaby      Cassey                                                      
Sales Rep. II        09/01/1979  $28,295                                        
M 10/10/1953 US                                                                 
121026 Terrill      Jaime                                                       
Sales Rep. IV        04/01/2010  $31,515                                        
M 11/08/1990 US                                                                 
121027 Allan        Rudder                                                      
Sales Rep. II        12/01/1993  $26,165                                        
M 05/05/1968 US                                                                 
121028 William      Smades                                                      
Sales Rep. I         11/01/2011  $26,585                                        
M 04/27/1992 US                                                                 
121029 Kuo-Chung    Mcelwee                                                     
Sales Rep. I         12/01/2011  $27,225                                        
M 12/22/1968 US                                                                 
121030 Jeryl        Areu                                                        
Sales Rep. I         02/01/2011  $26,745                                        
M 11/12/1983 US                                                                 
121031 Scott        Filan                                                       
Sales Rep. III       08/01/1989  $28,060                                        
M 07/09/1968 US                                                                 
121032 Nasim        Smith                                                       
Sales Rep. IV        03/01/2010  $31,335                                        
M 02/24/1992 US                                                                 
121033 Kristie      Snitzer                                                     
Sales Rep. III       06/01/2008  $29,775                                        
F 11/06/1990 US                                                                 
121034 John         Kirkman                                                     
Sales Rep. II        01/01/2011  $27,110                                        
M 08/23/1992 US                                                                 
121035 James        Blackley                                                    
Sales Rep. II        01/01/1978  $26,460                                        
M 03/25/1948 US                                                                 
121036 Teresa       Mesley                                                      
Sales Rep. I         10/01/2011  $25,965                                        
F 07/18/1992 US                                                                 
121037 Muthukumar   Miketa                                                      
Sales Rep. III       03/01/2006  $28,310                                        
M 06/12/1978 US                                                                 
121038 David        Anstey                                                      
Sales Rep. I         08/01/2011  $25,285                                        
M 02/13/1992 US                                                                 
121039 Donald       Washington                                                  
Sales Rep. II        05/01/1984  $27,460                                        
M 06/03/1958 US                                                                 
121040 Brienne      Darrohn                                                     
Sales Rep. III       11/01/1986  $29,525                                        
F 07/06/1963 US                                                                 
121041 Jaime        Wetherington                                                
Sales Rep. II        01/01/1978  $26,120                                        
F 02/04/1948 US                                                                 
121042 Joseph       Robbin-Coker                                                
Sales Rep. III       11/01/2003  $28,845                                        
M 04/04/1983 US                                                                 
121043 Sigrid       Kagarise                                                    
Sales Rep. II        03/01/1996  $28,225                                        
F 11/09/1973 US                                                                 
121044 Ray          Abbott                                                      
Sales Rep. I         08/01/2011  $25,660                                        
M 12/11/1958 US                                                                 
121045 Cascile      Hampton                                                     
Sales Rep. II        01/01/1998  $28,560                                        
F 06/13/1968 US                                                                 
121046 Roger        Mandzak                                                     
Sales Rep. I         07/01/2011  $25,845                                        
M 09/07/1988 US                                                                 
121047 Karen        Grzebien                                                    
Sales Rep. I         09/01/2011  $25,820                                        
F 11/26/1983 US                                                                 
121048 Lawrie       Clark                                                       
Sales Rep. I         09/01/2011  $26,560                                        
F 06/24/1988 US                                                                 
121049 Perrior      Bataineh                                                    
Sales Rep. I         12/01/2011  $26,930                                        
F 02/14/1990 US                                                                 
121050 Patricia     Capristo-Abramczyk                                          
Sales Rep. II        12/01/2010  $26,080                                        
F 01/12/1990 US                                                                 
121051 Glorina      Myers                                                       
Sales Rep. I         11/01/2011  $26,025                                        
F 05/02/1953 US                                                                 
121052 Richard      Fay                                                         
Sales Rep. II        11/01/2010  $26,900                                        
M 01/09/1990 US                                                                 
121053 Tywanna      Mcdade                                                      
Sales Rep. III       02/01/1978  $29,955                                        
F 09/23/1948 US                                                                 
121054 Daniel       Pulliam                                                     
Sales Rep. III       11/01/1980  $29,805                                        
M 11/12/1958 US                                                                 
121055 Clement      Davis                                                       
Sales Rep. III       08/01/2010  $30,185                                        
M 01/08/1992 US                                                                 
121056 Stacey       Lyszyk                                                      
Sales Rep. II        05/01/2007  $28,325                                        
F 07/05/1988 US                                                                 
121057 Tachaun      Voron                                                       
Sales Rep. I         12/01/2011  $25,125                                        
M 12/26/1963 US                                                                 
121058 Del          Kohake                                                      
Sales Rep. I         10/01/2011  $26,270                                        
M 07/12/1978 US                                                                 
121059 Jacqulin     Carhide                                                     
Sales Rep. II        04/01/1985  $27,425                                        
F 10/25/1963 US                                                                 
121060 Elizabeth    Spofford                                                    
Sales Rep. III       01/01/1978  $28,800                                        
F 06/08/1948 US                                                                 
121061 Lauris       Hassam                                                      
Sales Rep. III       07/01/1988  $29,815                                        
M 07/16/1958 US                                                                 
121062 Debra        Armant                                                      
Sales Rep. IV        08/01/2010  $30,305                                        
F 10/28/1988 US                                                                 
121063 Regi         Kinol                                                       
Sales Rep. II        08/01/2009  $35,990                                        
M 07/27/1983 US                                                                 
121064 Asishana     Polky                                                       
Sales Rep. I         09/01/2011  $25,110                                        
M 01/28/1968 US                                                                 
121065 Corneille    Malta                                                       
Sales Rep. III       04/01/2010  $28,040                                        
F 09/05/1988 US                                                                 
121066 Ceresh       Norman                                                      
Sales Rep. II        01/01/1978  $27,250                                        
F 08/23/1948 US                                                                 
121067 Jeanilla     Macnair                                                     
Sales Rep. IV        03/01/2010  $31,865                                        
F 01/18/1990 US                                                                 
121068 Salaheloin   Osuba                                                       
Sales Rep. II        09/01/1996  $27,550                                        
M 12/02/1973 US                                                                 
121069 Jason        Lapsley                                                     
Sales Rep. II        10/01/1994  $26,195                                        
M 03/19/1973 US                                                                 
121070 Agnieszka    Holthouse                                                   
Sales Rep. III       02/01/2010  $29,385                                        
F 11/04/1988 US                                                                 
121071 John         Hoppmann                                                    
Sales Rep. III       09/01/1981  $28,625                                        
M 09/10/1963 US                                                                 
121072 Christer     North                                                       
Sales Rep. I         09/01/2011  $26,105                                        
M 01/10/1983 US                                                                 
121073 Donald       Court                                                       
Sales Rep. I         01/01/2011  $27,100                                        
M 05/15/1953 US                                                                 
121074 Eric         Michonski                                                   
Sales Rep. I         10/01/2011  $26,990                                        
M 03/01/1963 US                                                                 
121075 Kasha        Sugg                                                        
Sales Rep. II        01/01/1978  $28,395                                        
F 12/23/1948 US                                                                 
121076 Micah        Cobb                                                        
Sales Rep. II        01/01/1987  $26,685                                        
M 10/09/1968 US                                                                 
121077 Bryce        Smotherly                                                   
Sales Rep. III       10/01/2010  $28,585                                        
M 09/05/1988 US                                                                 
121078 Lionel       Wende                                                       
Sales Rep. I         11/01/2011  $27,485                                        
M 05/01/1953 US                                                                 
121079 Azmi         Mees                                                        
Sales Rep. I         11/01/2011  $25,770                                        
M 06/03/1978 US                                                                 
121080 Kumar        Chinnis                                                     
Sales Rep. I         09/01/2011  $32,235                                        
M 01/24/1963 US                                                                 
121081 Susie        Knudson                                                     
Sales Rep. III       04/01/1980  $30,235                                        
F 03/28/1953 US                                                                 
121082 Richard      Debank                                                      
Sales Rep. III       10/01/1981  $28,510                                        
M 07/05/1953 US                                                                 
121083 Tingmei      Sutton                                                      
Sales Rep. I         03/01/2011  $27,245                                        
F 03/11/1963 US                                                                 
121084 Tulsidas     Ould                                                        
Sales Rep. I         01/01/2011  $22,710                                        
M 08/16/1968 US                                                                 
121085 Rebecca      Huslage                                                     
Sales Rep. IV        01/01/2011  $32,235                                        
M 11/12/1990 US                                                                 
121086 John-Michael Plybon                                                      
Sales Rep. I         01/01/2011  $26,820                                        
M 12/16/1948 US                                                                 
121087 Virtina      O'Suilleabhain                                              
Sales Rep. II        03/01/2003  $28,325                                        
F 12/07/1978 US                                                                 
121088 Momolu       Kernitzki                                                   
Sales Rep. I         01/01/2011  $27,240                                        
M 06/10/1992 US                                                                 
121089 Gregory      Sauder                                                      
Sales Rep. II        07/01/1978  $28,095                                        
M 08/21/1958 US                                                                 
121090 Betty        Klibbe                                                      
Sales Rep. I         02/01/2011  $26,600                                        
F 06/19/1958 US                                                                 
121091 Ernest       Kadiri                                                      
Sales Rep. II        01/01/1993  $27,325                                        
M 02/19/1973 US                                                                 
121092 Gynell       Pritt                                                       
Sales Rep. I         08/01/2011  $25,680                                        
F 03/08/1978 US                                                                 
121093 Carl         Vasconcellos                                                
Sales Rep. I         01/01/2011  $27,410                                        
M 07/18/1968 US                                                                 
121094 Larry        Tate                                                        
Sales Rep. I         09/01/2011  $26,555                                        
M 01/07/1958 US                                                                 
121095 Sara         Kratzke                                                     
Sales Rep. II        07/01/1995  $28,010                                        
F 04/14/1973 US                                                                 
121096 Robert       Newstead                                                    
Sales Rep. I         05/01/2011  $26,335                                        
M 05/18/1973 US                                                                 
121097 Willeta      Chernega                                                    
Sales Rep. II        10/01/1999  $26,830                                        
F 10/23/1978 US                                                                 
121098 Hal          Heatwole                                                    
Sales Rep. I         05/01/2011  $27,475                                        
M 03/22/1992 US                                                                 
121099 Royall       Mrvichin                                                    
Sales Rep. IV        05/01/2004  $32,725                                        
M 03/19/1983 US                                                                 
121100 Tzue-Ing     Cormell                                                     
Sales Rep. II        04/01/1980  $28,135                                        
M 04/27/1953 US                                                                 
121101 Burnetta     Buckner                                                     
Sales Rep. I         11/01/2011  $25,390                                        
F 08/28/1990 US                                                                 
121102 Rocheal      Flammia                                                     
Sales Rep. I         06/01/2011  $27,115                                        
F 06/26/1983 US                                                                 
121103 Brian        Farnsworth                                                  
Sales Rep. I         09/01/2011  $27,260                                        
M 04/28/1992 US                                                                 
121104 Leoma        Johnson                                                     
Sales Rep. II        04/01/1990  $28,315                                        
F 11/12/1968 US                                                                 
121105 Jessica      Savacool                                                    
Sales Rep. III       01/01/2007  $29,545                                        
F 05/09/1983 US                                                                 
121106 James        Hilburger                                                   
Sales Rep. I         02/01/2011  $25,880                                        
M 02/02/1973 US                                                                 
121107 Rose         Anger                                                       
Sales Rep. IV        07/01/2010  $31,380                                        
F 04/24/1990 US                                                                 
121108 Libby        Levi                                                        
Sales Rep. I         11/01/2011  $25,930                                        
F 07/04/1992 US                                                                 
121109 Harold       Boulus                                                      
Sales Rep. I         05/01/2011  $26,035                                        
M 11/05/1973 US                                                                 
121135 Tammy        Ruta                                                        
Sales Rep. I         08/01/2011  $27,010                                        
F 06/07/1958 US                                                                 
121136 Lesia        Galarneau                                                   
Sales Rep. I         12/01/2011  $27,460                                        
F 07/15/1978 US                                                                 
121137 Michael. R.  Boocks                                                      
Sales Rep. I         04/01/2011  $27,055                                        
M 01/18/1992 US                                                                 
121138 Hershell     Tolley                                                      
Sales Rep. I         01/01/2011  $27,265                                        
M 02/28/1953 US                                                                 
121139 Diosdado     Mckee                                                       
Sales Rep. II        07/01/1991  $27,700                                        
F 08/19/1963 US                                                                 
121140 Saunders     Briggi                                                      
Sales Rep. I         04/01/2011  $26,335                                        
M 01/23/1983 US                                                                 
121143 Louis        Favaron                                                     
Senior Sales Manager 07/01/2001  $95,090                                        
M 11/26/1973 US                                                                 
121144 Renee        Capachietti                                                 
Sales Manager        11/01/1995  $83,505                                        
F 06/28/1968 US                                                                 
121145 Dennis       Lansberry                                                   
Sales Manager        04/01/1980  $84,260                                        
M 11/22/1953 US                                          

               

Solution
‎11-10-2017 03:04 PM
New Contributor
Posts: 3

Re: Using line pointer controls with input statement

The raw data has 3 lines of code! You will need the #3 even if there is no data to read in.

 

data sales_staff2;
     infile "&path/sales2.dat";
     input   #1  Employee_ID 6.   @21 Last_Name $ 18. 
                #2   Job_Title $ 20.    @22 Hire_Date mmddyy10.   @ 33 Salary dollar8.

                #3 ;

     run;

 

and use the termstr option if the raw data is a Unix file.

 

 

Occasional Contributor
Posts: 9

Re: Using line pointer controls with input statement

Posted in reply to Sue-Little

Keeping two lines of code of raw data,you'll get it right too in putting the forward slash at the end of each line:.

 

data sales_staff2;
     infile "&path/sales2.dat";
     input     Employee_ID 6.   @21 Last_Name $ 18. /
                  Job_Title $ 20.    @22 Hire_Date mmddyy10.   @ 33 Salary dollar8./;

run;

SAS Super FREQ
Posts: 9,371

Re: Using line pointer controls with input statement

Hi:

  If you are using the Programming 2 course data, then you DO have the data or else the program would not work. When you ran the program to initially make the date in the Programming 2 course, it created SALES2.DAT. So if you used this INFILE statement:

infile "&path/sales2.dat";

And, IF you ran the setup code that included the %LET statement for PATH, then that is the location of your SALES2.DAT file.

 

  When you are working on the practices in the e-learning course, there is always a button for you to reveal the solution to the exercise. As shown by the postings you've received, there are 2 possible solutions -- one using the / to go to the next input line and one using the # to point to the specific input line.

 

  As shown from the screen shot inside the course, the data layout is revealed to you and both solutions:

sales2_data_example.png

 

If you are uncertain about the difference between using / or # in your INPUT statement, you could go back and listen to the lecture again on Line Pointer Controls. There is a lesson on each of them in the Table of Contents for Lesson 3.

 

Cynthia

Super User
Posts: 10,787

Re: Using line pointer controls with input statement

If you are read a UNIX file under windows OS, you need specify TERMSTR option: termstr=lf   termstr=crlf.

data sales_staff2;
     infile "&path/sales2.dat"  termstr=lf ;

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 14 replies
  • 722 views
  • 3 likes
  • 6 in conversation