Creating/Importing data in SAS
There is a simple way to add some data inside data step.
It uses datalines
data d1;
input a b;
datalines;
1 2
2 3
4 5
2 2
5 76
4 2
;
run;```
```sas
proc print data = d1;
run;```
## Less variables, more data
When we have declared less variables but the input data is more.
```sas
data work.test3;
input x y;
datalines;
1 2 55
3 2 112
5 3 223
3 1 4
5928 2 10
;
run;
proc print data = work.test3;
run;
data work.test4;
input x y p q;
datalines;
1 2 55
3 4 77
5 6 99
7 8 33
9 10 44
;
run;
proc print data = work.test4;
run;
data test6;
input x y;
datalines;
1
;
run;
proc print data= test6;
run;
Datalines reads the data from one line and moves to the next line.
It uses infile
data work.test7;
infile 'e:\22jun\sp.txt';
input x y;
run;
data work.test8;
x=12;
y=123;
run;
proc print data = work.test8;
run;
proc print data=sashelp.baseball;
run;
Type it slowly and it will show the list of all possible areas where you need to make this change.