To read the file cars3.dat, use the following syntax. Here's what the data in the file cars3.dat look like: AMC Concord2229304099 Suppose you are using a PC and you have a file named cars3.dat, that is stored in the c:\carsdata directory of your computer. Reading fixed formatted data from an external file The benefit of fixed formatted data is that you can fit more information on a line when you do not use delimiters such as spaces or commas.ĥ Buick Elec7827 3. For example, if we rearrange the cars data from above, we can read it as fixed formatted data: DATA cars2 This also requires the data to be in the same columns for each case. That is, you need to provide the beginning and ending column numbers for each variable. Usually, because there are no delimiters (such as spaces, commas, or tabs) to separate fixed formatted data, column definitions are required for every variable in the dataset. Here is the output produced by the proc print statement above.įixed formatted data can also be read instream. For example:Īfter reading in the data with a data step, it is usually a good idea to print the first few cases of your dataset to check that things were read correctly. Spaces are usually used to "delimit" (or separate) free formatted data. This approach is good for relatively small datasets. One of the most common ways to read data into SAS is by reading the data instream in a data step - that is, by typing the data directly into the syntax of your SAS program. UCLA: Statistical Consulting Group.įrom (accessed August 11, 2015).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |