14. Bringing data into SAS
data patients;
input name $ gender $ age weight;
cards;
John M 48 128.6
Peter M 58 158.3
Liz F 45 115.5
Joe M 28 170.1
;
run;
There are three methods of bringing data into SAS. The first method is using existing data within SAS, such as data in the permanent libraries. The second method is creating data within the SAS programming window. The third method is importing data from external sources, such as Excel spreadsheets or other databases.
The different methods for bringing data into SAS are discussed here.
1.The first method is using existing data in SAS, which is stored in permanent libraries. This can be done through a data step in SAS, which involves specifying the data set name and the library it is coming from.
2.The second method is creating data within the SAS programming window and storing it in either permanent or temporary libraries. This is also done through a data step, using the input statement to specify the variable names and using the datalines statement to input the data.
3.The third method is importing data from external sources, such as Excel sheets or databases. This can be done using the proc import statement, which allows you to specify the file path and file type of the data. There are other methods to import data which can be done using the infile and input statements.
0 comments