- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The log: "
Anyone know why this data is not importing correctly? note: I have corrected the spelling error in the out statement already
libname dat_raw '/folders/myfolders/DATASETS/DAT'; data dat_raw.stress2; data stress2; set dat_raw.stress2; file '/folders/myfolders/DATASETS/DAT/dat_raw/stress2.txt'; put name $ 1-20 resthr 22-24 maxhr 26-28 rechr 30-32 timemin 34-36 timesec 38-40 tolerance 42; proc print; run; proc import datafile='/folders/myfolders/DATASETS/DAT/dat_raw/stress2.txt' DBMS=tab out=dat_raw.stress2 replace; proc print; run; proc export data=dat_raw.stress2 DBMS=xls replace outfile='/folders/myfolders/DATASETS/DAT/dat_raw/stress2.xls'; proc print; run; proc export data=dat_raw.stress2 DBMS=csv replace outfile='/folders/myfolders/DATASETS/DAT/dat_raw/stress2.csv';
114 libname dat_raw '/folders/myfolders/DATASETS/DAT'; NOTE: Libref DAT_RAW was successfully assigned as follows: Engine: V9 Physical Name: /folders/myfolders/DATASETS/DAT NOTE: There were 5 observations read from the data set WORK.NEW. NOTE: PROCEDURE PRINT used (Total process time): real time 0.05 seconds cpu time 0.04 seconds 115 data dat_raw.stress2; 116 NOTE: The data set DAT_RAW.STRESS2 has 1 observations and 0 variables. NOTE: DATA statement used (Total process time): real time 0.04 seconds cpu time 0.02 seconds 117 data stress2; 118 set dat_raw.stress2; 119 file '/folders/myfolders/DATASETS/DAT/dat_raw/stress2.txt'; 120 put name $ 1-20 resthr 22-24 maxhr 26-28 rechr 30-32 timemin 34-36 timesec 38-40 121 tolerance 42; 122 NOTE: Variable name is uninitialized. NOTE: Variable resthr is uninitialized. NOTE: Variable maxhr is uninitialized. NOTE: Variable rechr is uninitialized. NOTE: Variable timemin is uninitialized. NOTE: Variable timesec is uninitialized. NOTE: Variable tolerance is uninitialized. NOTE: The file '/folders/myfolders/DATASETS/DAT/dat_raw/stress2.txt' is: Filename=/folders/myfolders/DATASETS/DAT/dat_raw/stress2.txt, Owner Name=root,Group Name=vboxsf, Access Permission=-rwxrwx---, Last Modified=08Oct2020:12:18:51 NOTE: 1 record was written to the file '/folders/myfolders/DATASETS/DAT/dat_raw/stress2.txt'. The minimum record length was 42. The maximum record length was 42. NOTE: There were 1 observations read from the data set DAT_RAW.STRESS2. NOTE: The data set WORK.STRESS2 has 1 observations and 7 variables. NOTE: DATA statement used (Total process time): real time 0.03 seconds cpu time 0.01 seconds 122 ! proc print; run; NOTE: There were 1 observations read from the data set WORK.STRESS2. NOTE: PROCEDURE PRINT used (Total process time): real time 0.02 seconds cpu time 0.02 seconds 123 124 proc import datafile='/folders/myfolders/DATASETS/DAT/dat_raw/stress2.txt' 125 DBMS=tab out=dat_raw.stress2 replace; 126 NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to WORK.PARMS.PARMS.SLIST. Unable to sample external file, no data in first 5 records. ERROR: Import unsuccessful. See SAS Log for details. NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE IMPORT used (Total process time): real time 0.33 seconds cpu time 0.20 seconds 126 ! proc print; run; NOTE: There were 1 observations read from the data set WORK.STRESS2. NOTE: PROCEDURE PRINT used (Total process time): real time 0.05 seconds cpu time 0.05 seconds 127 128 proc export data=dat_raw.stress2 DBMS=xls replace 129 outfile='/folders/myfolders/DATASETS/DAT/dat_raw/stress2.xls'; 130 ERROR: File DAT_RAW.STRESS2.DATA does not exist. NOTE: The SAS System stopped processing this step because of errors. NOTE: PROCEDURE EXPORT used (Total process time): real time 0.08 seconds cpu time 0.02 seconds 130 ! proc print; run; NOTE: There were 1 observations read from the data set WORK.STRESS2. NOTE: PROCEDURE PRINT used (Total process time): real time 0.05 seconds cpu time 0.06 seconds 131 132 proc export data=dat_raw.stress2 DBMS=csv replace 133 outfile='/folders/myfolders/DATASETS/DAT/dat_raw/stress2.csv'; 134 /* 135 data _NULL_; 136 file '/folders/myfolders/DATASETS/DAT/dat_raw/stress2_1.txt'; 137 put name $ 1-20 resthr 22-24 maxhr 26-28 rechr 30-32 timemin 34-36 timesec 38-40 138 tolerance 42; 139 proc print; 140 run; 141 142 proc import datafile='/folders/myfolders/DATASETS/DAT/dat_raw/stress2_1.txt' 143 DBMS=tab out=_NULL replace; 144 proc print; run; 145 146 proc export data=stress2 DBMS=xls replace 147 outfile='/folders/myfolders/DATASETS/DAT/dat_raw/stress2_1.xls'; 148 proc print; run; 149 150 proc export data=stress2 DBMS=csv replace 151 outfile='/folders/myfolders/DATASETS/DAT/dat_raw/stress2_1.txt'; 152 153 154 155 156 157 158 ods rtf 159 file='/folders/myfolders/DATASETS/stress2_1.rtf'; 160 */ 161 162 163 164 165 166 167 168 169 170 171 172 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to WORK.PARMS.PARMS.SLIST. ERROR: File DAT_RAW.STRESS2.DATA does not exist. ERROR: Export unsuccessful. See SAS Log for details. 184
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Copy the LOG as text, paste it into the window that appears when you click on the </> icon. We need to see the ENTIRE log for these steps (and not for dozens of steps before this). Show us the LOG for these steps, including code as it appears in the log, along with all ERRORs, NOTEs and WARNINGs, for these steps, unedited. Do not show us screen captures of LOG or SAS code.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I have edited the post and included the log. thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved toWORK.PARMS.PARMS.SLIST.
Often means that you have more than one SAS session open at one time. The the SASUSER.PARMS is used to maintain some of your user preferences or custom SAS settings.
More of concern is why are you reading the file with a data step and then overwriting it with a Proc import call?
The note: Unable to sample external file, no data in first 5 records
means that from what SAS is seeing your text file has nothing in it for the first 5 lines and Proc import is quitting because of no valid data.
There is not need to go to the headache of creating a PDF file, which is throwing an error when I try to read it. Copy the text and paste into a code box opened on the forum using the </> icon.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I was trying to create a fixed file stress2_1.txt from the permanent data set stress2, then to go on and open the file with the import function and to also export it as a xlx and a csv file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
As your first DATA statement very effectively destroyed the dataset ("1 observation and 0 variables"), you first need to recreate the dataset.
And remove that statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Curious4 wrote:
I was trying to create a fixed file stress2_1.txt from the permanent data set stress2,
That part of your code is correct, except for the fact that the prior step destroyed the stress2 part and you did not export the variable names.
@Curious4 wrote:
open the file with the import function
You cannot do that for a fixed width file. You need to write a data step to import data when it's been exported as fixed width file. If you exported it as tab or comma delimited then you could read it. In a fixed width file, records can be all squished together so the compiler cannot interpret where variables start and end with any certainty. When you import it, you should give it a unique name otherwise it replaces your old data set. Until you have it correctly coded, this isn't really what you want to do.
@Curious4 wrote:
to also export it as a xlx and a csv file.
Your code for that is fine - try it based on a different data set or directly from the raw_data.stress2 data set.
@Curious4 wrote:
I was trying to create a fixed file stress2_1.txt from the permanent data set stress2, then to go on and open the file with the import function and to also export it as a xlx and a csv file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The problem is partly your second line of code. This doesn't do anything and may have destroyed your input data set.
Your code is currently taking a data set, writing it out fixed width file and then tries to read it back in as tab delimited. Is that what you intended?
data dat_raw.stress2;
@Curious4 wrote:
The log: "
NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved toWORK.PARMS.PARMS.SLIST.Unable to sample external file, no data in first 5 records"
Anyone know why this data is not importing correctly? note: I have corrected the spelling error in the out statement already.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I created a new data set
data stress2_1;
proc import datafile='/folders/myfolders/DATASETS/DAT/dat_raw/stress2.txt'
DBMS=tab out=stress2_1 replace;
proc print; run;
stress2 still seems to be emptied.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Run the following to do that:
proc contents data=data_raw.stress2;
run;
Second confirm your export works as expected. Go open the text file and see if has the headers and values expected.
You cannot export a file using a fixed width format and then try and read it in again using PROC IMPORT. You need to write a data step to read it in instead. That would be step 3.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@Curious4 wrote:
I thought you said dat_raw.stress2 was deleting everything?
I don't know what you're asking here.
That is just a reference to a data set in your sentence above.
I said that this line (note the DATA) may delete your original data set, which is why I'm asking you to confirm that it does exist before proceeding further.
data dat_raw.stress2;