262 PROC IMPORT datafile=mouse;
ERROR: Output SAS data set must be provided.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
263 Mouse; Day3; Day6; Day9; Day12; Day15; Day18; Day21;
264 1 0.109 0.388 0.621 0.823 1.078 1.132 1.191
265 2 0.218 0.393 0.568 0.729 0.839 0.852 1.004
266 3 0.394 0.549 0.700 0.783 0.870 0.925
267 4 0.209 0.419 0.645 0.850 1.001 1.026 1.069
268 5 0.193 0.362 0.520 0.530 0.641 0.640 0.751
269 6 0.201 0.361 0.502 0.530 0.641 0.640 0.751
270 7 0.202 0.370 0.498 0.650 0.795 0.858 0.910
271 8 0.190 0.350 0.666 0.819 0.879 0.929
272 9 0.219 0.399 0.578 0.699 0.709 0.822 0.953
273 10 0.255 0.400 0.545 0.690 0.796 0.825 0.836
274 11 0.224 0.381 0.577 0.756 0.869 0.929 0.999
275 12 0.187 0.329 0.441 0.525 0.621 0.796
276 13 0.278 0.471 0.606 0.770 0.888 1.001 1.105
277 ;
278 RUN
I am trying to create a new dataset.
data mouse;
infile datalines truncover;
input Mouse Day3 Day6 Day9 Day12 Day15 Day18 Day21;
datalines;
1 0.109 0.388 0.621 0.823 1.078 1.132 1.191
2 0.218 0.393 0.568 0.729 0.839 0.852 1.004
3 0.394 0.549 0.700 0.783 0.870 0.925
4 0.209 0.419 0.645 0.850 1.001 1.026 1.069
5 0.193 0.362 0.520 0.530 0.641 0.640 0.751
6 0.201 0.361 0.502 0.530 0.641 0.640 0.751
7 0.202 0.370 0.498 0.650 0.795 0.858 0.910
8 0.190 0.350 0.666 0.819 0.879 0.929
9 0.219 0.399 0.578 0.699 0.709 0.822 0.953
10 0.255 0.400 0.545 0.690 0.796 0.825 0.836
11 0.224 0.381 0.577 0.756 0.869 0.929 0.999
12 0.187 0.329 0.441 0.525 0.621 0.796
13 0.278 0.471 0.606 0.770 0.888 1.001 1.105
;
RUN;
You have some lines that do not have values for all of the variables - e.g. Mouse 3 .
This code assumes that it is the last variable (Day 21) that is missing - I can't tell from your formatting if this is a valid assumption .
How do I upload a text file so the formatting is not off? This is the file.
you initially said this was your code
PROC IMPORT datafile=mouse;
Mouse; Day3; Day6; Day9; Day12; Day15; Day18; Day21;
1 0.109 0.388 0.621 0.823 1.078 1.132 1.191
2 0.218 0.393 0.568 0.729 0.839 0.852 1.004
3 0.394 0.549 0.700 0.783 0.870 0.925
4 0.209 0.419 0.645 0.850 1.001 1.026 1.069
5 0.193 0.362 0.520 0.530 0.641 0.640 0.751
6 0.201 0.361 0.502 0.530 0.641 0.640 0.751
7 0.202 0.370 0.498 0.650 0.795 0.858 0.910
8 0.190 0.350 0.666 0.819 0.879 0.929
9 0.219 0.399 0.578 0.699 0.709 0.822 0.953
10 0.255 0.400 0.545 0.690 0.796 0.825 0.836
11 0.224 0.381 0.577 0.756 0.869 0.929 0.999
12 0.187 0.329 0.441 0.525 0.621 0.796
13 0.278 0.471 0.606 0.770 0.888 1.001 1.105
;
RUN
that would be the incorrect way to create a dataset , because you don't use proc import and then type in the values.
Are you saying your data is actually in an external file?
Here is one approach using datelines (you write the values in the code). The The double trailing @@ is useful to indicate that a record needs to be reread on the next iteration of the DATA step.
DLM="09"x indicates that values are separated by a tabulation.
DSD indicates that there can be missing values (two delimiters are not interpreted as a single one).
data mouse;
infile datalines dlm="09"x dsd;
input Mouse Day3 Day6 Day9 Day12 Day15 Day18 Day21 @@;
datalines;
1 0.109 0.388 0.621
0.823 1.078 1.132 1.191
2 0.218 0.393 0.568
0.729 0.839 0.852 1.004
3 0.394 0.549
0.700 0.783 0.870 0.925
4 0.209 0.419 0.645
0.850 1.001 1.026 1.069
5 0.193 0.362 0.520
0.530 0.641 0.640 0.751
6 0.201 0.361 0.502
0.530 0.641 0.640 0.751
7 0.202 0.370 0.498
0.650 0.795 0.858 0.910
8 0.190 0.350
0.666 0.819 0.879 0.929
9 0.219 0.399 0.578
0.699 0.709 0.822 0.953
10 0.255 0.400 0.545
0.690 0.796 0.825 0.836
11 0.224 0.381 0.577
0.756 0.869 0.929 0.999
12 0.187 0.329 0.441
0.525 0.621 0.796
13 0.278 0.471 0.606
0.770 0.888 1.001 1.105
;
run;
You can also directly import the txt file:
proc import datafile="/path/MiceWeight.txt" /*update the physical path*/
out=mouse
dbms=tab
replace;
run;
@harveysarah0 wrote:
How do I upload a text file so the formatting is not off? This is the file.
At the top of the message window is a row of icons. If you click on the one that looks like {I} then you will get a code box that treats pasted text as is and will not reformat. The result will look something like
This is my plain text 1 2 3 5 6 999
Or the "running man" icon, which will provide syntax highlighting for SAS code.
I still receive this error after fixing my formatting.
NOTE: Attachments for -3 reestablished for new parent.
NOTE: Import Cancelled.
315 PROC IMPORT datafile=mouse;
ERROR: Output SAS data set must be provided.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
This is my new code:
PROC IMPORT datafile=mouse;
Mouse Day3 Day6 Day9 Day12 Day15 Day18 Day21
1 0.109 0.388 0.621. 0.823 1.078 1.132 1.191
2 0.218 0.393 0.568 0.729 0.839 0.852 1.004
3 0.394 0.549 0.700 0.783 0.870 0.925
4 0.209 0.419 0.645. 0.850 1.001 1.026 1.069
5 0.193 0.362 0.520. 0.530 0.641 0.640 0.751
6 0.201 0.361 0.502. 0.530 0.641 0.640 0.751
7 0.202 0.370 0.498. 0.650 0.795 0.858 0.910
8 0.190 0.350 0.666 0.819 0.879 0.929.
9 0.219 0.399 0.578 0.699 0.709 0.822 0.953
10 0.255 0.400 0.545. 0.690 0.796 0.825 0.836
11 0.224 0.381 0.577. 0.756 0.869 0.929 0.999
12 0.187 0.329 0.441. 0.525 0.621 0.796
13 0.278 0.471 0.606 0.770 0.888 1.001 1.105
;
RUN
It does not look properly formatted here but I lined everything up in SAS.
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.