SAS Blog 1 Part 2 : Working with simple data sets
Lets look into further questions. I am picking few questions to make you understand the variety while working on simple datasets
Code:
filename geo "C:\Users\Elcot\Desktop\Term1\SAS Folders\Day 2\Set_1\geocaching.txt";
data geocaching;
infile geo ;
input Name $1-20
longdeg 21-22
longmin 23-28
latdeg 29-30
latmin 31-36;
run;
proc print data = geocaching;
run;
proc contents data= geocaching;
run;
Important: here we specifying the range of column input like for name it is from 1-20 here we are directing the data statement to read from 1-20, then longdeg from 21-22,longmin from 23-28 and so on
Other way of writing the code
filename geo "C:\Users\Elcot\Desktop\Term1\SAS Folders\Day 2\Set_1\geocaching.txt";
data geocaching;
infile geo ;
input
@1 Name $19.
@21 longdeg 2.
@23 longmin 5.
@29 latdeg 2.
@31 latmin 6.
;
run;
In this we are using the column pointer to specify the start of the column like for name it is 1 longdeg it is 21 longmin it is 23 latdeg it is 29 and latmin it is 31
Code:
filename geo "C:\Users\Elcot\Desktop\Term1\SAS Folders\Day 2\Set_1\geocaching.txt";
data geocaching;
infile geo ;
input Name $1-20
longdeg 21-22
longmin 23-28
latdeg 29-30
latmin 31-36;
run;
proc print data = geocaching;
run;
proc contents data= geocaching;
run;
Important: here we specifying the range of column input like for name it is from 1-20 here we are directing the data statement to read from 1-20, then longdeg from 21-22,longmin from 23-28 and so on
Other way of writing the code
filename geo "C:\Users\Elcot\Desktop\Term1\SAS Folders\Day 2\Set_1\geocaching.txt";
data geocaching;
infile geo ;
input
@1 Name $19.
@21 longdeg 2.
@23 longmin 5.
@29 latdeg 2.
@31 latmin 6.
;
run;
In this we are using the column pointer to specify the start of the column like for name it is 1 longdeg it is 21 longmin it is 23 latdeg it is 29 and latmin it is 31
Comments
Post a Comment