- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Please could someone help me to carry out PROC MIXED analysis of a crossover study in On Demand? I am looking to assess treatment effects from a crossover study using a linear mixed model, with change-from-baseline (Δ) for each 4-wk dietary intervention (calculated by subtracting: wk 0 from wk 4 values and; wk 8 from wk 12 values) as the dependent variable, adjusted for fixed effects of baseline values of the assessed variable, period, sequence, treatment, age, gender and BMI.
The attached files worked fine with the University edition of the software, but I no longer have access to this software. I am getting error messages, such as 'ERROR: Variable RESPONSE not found.'
Thanks in advance for your help.
Oons
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Start addressing problems starting at the top of a program.
The first problem I see is a bunch of invalid data messages. Those occur when you try to read incompatible data from the instructions you have provided on the INPUT statement and Informats. Such as trying to read "abc" as a numeric value or reading a date that looks like 01JAN2020 with a YYMMDD informat that expects values like 20200101.
So since your data step
69 Data CrossOver; 70 infile "/home/u44908311/food_crossover_project/FoodCrossOverExample.sas"; 71 input Subject Gender $ BMI Age Sequence $ Period Treatment $ Baseline After Difference; 72 run;
it looks like you are trying to read a PROGRAM file, not data.
Lets examine the first "invalid data message" and describe how to read and interpret what it shows.
Please see in the first few lines where it has one of the Variable names from the INPUT statement and some details. First indicator is that there are different LINES mentioned. Those are lines in the source file.
So Subject was read from the first line starting at column 1 through 4 and was invalid. Your Input statement indicates subject should contain a numeric value so something not valid as a number was encountered.
BMI was read from line 2, columns 3 through 8. Again BMI on the input statement expects numeric values and ran into something else, as did Age
And Period, but that was reading at line 3 as were Baseline, After and Difference.
Now for a very important diagnostic. The part that says Rule is to help identify columns the + are values like 5, 15, 25, 35, etc. the 1, 2,3 are columns 10, 20,30.
The line in the log that starts with 3 shows the TEXT of the line. Which shows program code, not values.
So, why are you attempting to read a file containing CODE into a DATA set?????
The multiple lines are because your INFILE statement has no restriction to read on a single line, typically MISSOVER as used in the Proc Import generated code or TRUNCOVER.
NOTE: Invalid data for Subject in line 1 1-4. NOTE: Invalid data for BMI in line 2 3-8. NOTE: Invalid data for Age in line 2 10-75. NOTE: Invalid data for Period in line 3 9-15. NOTE: Invalid data for Baseline in line 3 24-24. NOTE: Invalid data for After in line 3 26-28. NOTE: Invalid data for Difference in line 3 30-32. RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 3 input Subject Gender $ BMI Age Sequence $ Period Treatment $ Baseline After Difference; 89
Because so many of the variables in the resultant Crossover data set are missing code using it will likely not perform very well. Which is not surprising. So read a proper file containing data though it looks like the WORK.IMPORT is what you wanted.
So for the Data Crossover Infile statement read REFFILE, using a file reference, or '/home/u44908311/food_crossover_project/SBP_n13.csv' instead of "/home/u44908311/food_crossover_project/FoodCrossOverExample.sas". ADD delimiter=',' because the file is comma delimited and one of MISSOVER or TRUNCOVER (just in case one of the lines is short)
I see that you did a Proc Print data=crossover; Did you actually look at any of the results? Most of the variables would have been missing, which is what your proc mixed complains about, and the rest should have looked pretty odd for variables with names like Gender Sequence and Treatment.
So, READ the right file, the right way before attempting any analysis.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please post the complete (all code and messages) log by copy/pasting the text into a window opened with this button:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi, thank you for your reply. Below please find the log:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Pleae use the proper sub-window (by using the button I indicated in a picture!) so that the formatting won't get lost.
The first ERROR message:
ERROR: Physical file does not exist, /home/u44908311/sasuser.v94/Cross Over.txt.
is the most important one, as all other issues might be a consequence. Always debug your codes from the start, not from the end.
On a UNIX system (as SAS On Demand uses), spelling of filenames is important, as the system is case-sensitive throughout. Since blanks are natural word separators, they should be avoided (Maxim 44).
- replace the blank with an underline
- do not use the sasuser.v94 directory for your files; it is the location of the SASUSER library, let SAS keep it for its data
- do not use mixed case in filenames, it causes confusion
- upload the file to your home directory, and use it from there; after uploading, right-click it and copy the path from the properties
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
PROC MIXED syntax runs the same way on SAS OnDemand for Academics and University Edition.
The second line of your program reads in the file "Cross Over.txt". Your issue is likely that you need to edit your program to specify the file location for SAS On Demand for Academics. To see the file location within SAS OnDemand for Academics, right click on the file name then select Properties in the menu. Then put that location in your program.
For example- if the file location is /home/uXXXXX/Cross Over.txt then edit the second line of your program to read:
infile "/home/uXXXXX/Cross Over.txt";
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for you reply, Jackie.
I amended the infile name as follows:
infile "/home/u44908311/sasuser.v94/Cross Over.txt";
input Subject Gender $ BMI Age Sequence $ Period Treatment $ Baseline After Difference;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Noted. Thank you for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
thank you for your help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Are you still having the issue after moving the file out of the sasuser folder and after making any edits to the file name for correct casing?
If so- please upload a screen shot of your files area of SAS OnDemand for Academics, so we can see where you have the file stored and also what it is named.
You might also try renaming the file to a name that does not have internal spaces-- ie. CrossOver.txt-- and of course editing your program to reflect the new name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Apologies for the delayed response—I was on annual leave.
I’ve moved the files out of the sasuser folder as suggested and attempted to rename them. However, I am still unable to run the program. I’ve attached some screenshots for your reference.
Thank you for your continued support!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
First, please do not provide pictures of code or log results. It is extremely hard to copy/paste/edit to show likely corrections to code.
Best on this forum is to open a text box using the </> icon that appears above the message window. Then copy the text from the editor or log and paste the text.
Or if you must attach documents make sure it is text and not pictures.
Second, that attached document shows nothing about errors, code not running or any problem at all. So either you didn't get the right bits in the document or shared the wrong document.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 68 69 /* Generated Code (IMPORT) */ 70 /* Source File: SBP_n13.csv */ 71 /* Source Path: /home/u44908311/food_crossover_project */ 72 /* Code generated on: 9/27/24, 11:38 AM */ 73 74 %web_drop_table(WORK.IMPORT); NOTE: Table WORK.IMPORT has been dropped. NOTE: PROCEDURE SQL used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 205.25k OS Memory 24484.00k Timestamp 09/27/2024 10:44:10 AM Step Count 69 Switch Count 2 Page Faults 0 Page Reclaims 14 Page Swaps 0 Voluntary Context Switches 10 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 0 75 76 77 FILENAME REFFILE '/home/u44908311/food_crossover_project/SBP_n13.csv'; 78 79 PROC IMPORT DATAFILE=REFFILE 80 DBMS=CSV 81 OUT=WORK.IMPORT; 82 GETNAMES=YES; 83 RUN; NOTE: Unable to open parameter catalog: SASUSER.PARMS.PARMS.SLIST in update mode. Temporary parameter values will be saved to WORK.PARMS.PARMS.SLIST. 84 /********************************************************************** 85 * PRODUCT: SAS 86 * VERSION: 9.4 87 * CREATOR: External File Interface 88 * DATE: 27SEP24 89 * DESC: Generated SAS Datastep Code 90 * TEMPLATE SOURCE: (None Specified.) 91 ***********************************************************************/ 92 data WORK.IMPORT ; 93 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */ 94 infile REFFILE delimiter = ',' MISSOVER DSD firstobs=2 ; 95 informat Subject best32. ; 96 informat Gender $1. ; 97 informat BMI best32. ; 98 informat Age best32. ; 99 informat Sequence $2. ; 100 informat Period best32. ; 101 informat Treatment $1. ; 102 informat Baseline best32. ; 103 informat After best32. ; 104 informat Difference best32. ; 105 format Subject best12. ; 106 format Gender $1. ; 107 format BMI best12. ; 108 format Age best12. ; 109 format Sequence $2. ; 110 format Period best12. ; 111 format Treatment $1. ; 112 format Baseline best12. ; 113 format After best12. ; 114 format Difference best12. ; 115 input 116 Subject 117 Gender $ 118 BMI 119 Age 120 Sequence $ 121 Period 122 Treatment $ 123 Baseline 124 After 125 Difference 126 ; 127 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro variable */ 128 run; NOTE: The infile REFFILE is: Filename=/home/u44908311/food_crossover_project/SBP_n13.csv, Owner Name=u44908311,Group Name=oda, Access Permission=-rw-r--r--, Last Modified=10Sep2024:15:42:38, File Size (bytes)=887 NOTE: 26 records were read from the infile REFFILE. The minimum record length was 26. The maximum record length was 31. NOTE: The data set WORK.IMPORT has 26 observations and 10 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds user cpu time 0.01 seconds system cpu time 0.00 seconds memory 9295.50k OS Memory 31260.00k Timestamp 09/27/2024 10:44:10 AM Step Count 70 Switch Count 2 Page Faults 0 Page Reclaims 138 Page Swaps 0 Voluntary Context Switches 15 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 264 26 rows created in WORK.IMPORT from REFFILE. NOTE: WORK.IMPORT data set was successfully created. NOTE: The data set WORK.IMPORT has 26 observations and 10 variables. NOTE: PROCEDURE IMPORT used (Total process time): real time 0.03 seconds user cpu time 0.03 seconds system cpu time 0.01 seconds memory 9295.50k OS Memory 31520.00k Timestamp 09/27/2024 10:44:10 AM Step Count 70 Switch Count 8 Page Faults 0 Page Reclaims 1367 Page Swaps 0 Voluntary Context Switches 75 Involuntary Context Switches 1 Block Input Operations 0 Block Output Operations 320 129 130 PROC CONTENTS DATA=WORK.IMPORT; RUN; NOTE: PROCEDURE CONTENTS used (Total process time): real time 0.02 seconds user cpu time 0.03 seconds system cpu time 0.00 seconds memory 1750.96k OS Memory 26028.00k Timestamp 09/27/2024 10:44:10 AM Step Count 71 Switch Count 0 Page Faults 0 Page Reclaims 95 Page Swaps 0 Voluntary Context Switches 3 Involuntary Context Switches 3 Block Input Operations 0 Block Output Operations 8 131 132 133 %web_open_table(WORK.IMPORT); 134 135 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 145
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 68 69 Data CrossOver; 70 infile "/home/u44908311/food_crossover_project/FoodCrossOverExample.sas"; 71 input Subject Gender $ BMI Age Sequence $ Period Treatment $ Baseline After Difference; 72 run; NOTE: The infile "/home/u44908311/food_crossover_project/FoodCrossOverExample.sas" is: Filename=/home/u44908311/food_crossover_project/FoodCrossOverExample.sas, Owner Name=u44908311,Group Name=oda, Access Permission=-rw-r--r--, Last Modified=27Sep2024:11:43:57, File Size (bytes)=814 NOTE: Invalid data for Subject in line 1 1-4. NOTE: Invalid data for BMI in line 2 3-8. NOTE: Invalid data for Age in line 2 10-75. NOTE: Invalid data for Period in line 3 9-15. NOTE: Invalid data for Baseline in line 3 24-24. NOTE: Invalid data for After in line 3 26-28. NOTE: Invalid data for Difference in line 3 30-32. RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 3 input Subject Gender $ BMI Age Sequence $ Period Treatment $ Baseline After Difference; 89 NOTE: Invalid data errors for file '"/home/u44908311/food_crossover_project/FoodCrossOverExample.sas"' occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Subject=. Gender=CrossOve BMI=. Age=. Sequence=input Period=. Treatment=Gender Baseline=. After=. Difference=. _ERROR_=1 _N_=1 NOTE: Invalid data for Subject in line 4 1-4. NOTE: Invalid data for BMI in line 6 6-10. NOTE: Invalid data for Age in line 6 12-15. NOTE: Invalid data for Period in line 6 19-28. NOTE: Invalid data for Baseline in line 9 1-4. NOTE: Invalid data for After in line 9 6-10. NOTE: Invalid data for Difference in line 9 12-15. 9 Proc Mixed data = CrossOver; 28 NOTE: Invalid data errors for file '"/home/u44908311/food_crossover_project/FoodCrossOverExample.sas"' occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Subject=. Gender=proc BMI=. Age=. Sequence== Period=. Treatment=run; Baseline=. After=. Difference=. _ERROR_=1 _N_=2 NOTE: Invalid data for Subject in line 10 3-7. NOTE: Invalid data for BMI in line 10 17-22. NOTE: Invalid data for Age in line 10 24-31. NOTE: Invalid data for Period in line 10 40-49. NOTE: Invalid data for Baseline in line 11 9-18. NOTE: Invalid data for After in line 11 20-20. NOTE: Invalid data for Difference in line 11 22-27. 11 model Difference = Gender BMI Age Period Treatment Baseline; 62 NOTE: Invalid data errors for file '"/home/u44908311/food_crossover_project/FoodCrossOverExample.sas"' occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Subject=. Gender=Subject BMI=. Age=. Sequence=Period Period=. Treatment=model Baseline=. After=. Difference=. _ERROR_=1 _N_=3 NOTE: Invalid data for Subject in line 12 3-8. NOTE: Invalid data for BMI in line 13 3-9. NOTE: Invalid data for Age in line 13 11-19. NOTE: Invalid data for Period in line 13 23-28. NOTE: Invalid data for Baseline in line 17 1-4. NOTE: Invalid data for After in line 17 6-22. NOTE: Invalid data for Difference in line 18 3-8. RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 18 infile "CrossOverMissing"; 28 NOTE: Invalid data errors for file '"/home/u44908311/food_crossover_project/FoodCrossOverExample.sas"' occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Subject=. Gender=Subject; BMI=. Age=. Sequence=/ Period=. Treatment=run; Baseline=. After=. Difference=. _ERROR_=1 _N_=4 NOTE: Invalid data for Subject in line 19 3-7. NOTE: Invalid data for BMI in line 19 17-22. NOTE: Invalid data for Age in line 19 24-24. NOTE: Invalid data for Period in line 19 30-32. NOTE: Invalid data for Baseline in line 19 43-43. NOTE: Invalid data for After in line 19 45-50. NOTE: Invalid data for Difference in line 19 52-60. 19 input Subject Gender $ BMI Age Sequence $ Period Treatment $ Baseline After Difference; 89 Subject=. Gender=Subject BMI=. Age=. Sequence=BMI Period=. Treatment=Sequence Baseline=. After=. Difference=. _ERROR_=1 _N_=5 NOTE: Invalid data for Subject in line 20 1-4. NOTE: Invalid data for BMI in line 22 6-10. NOTE: Invalid data for Age in line 22 12-15. NOTE: Invalid data for Period in line 22 19-35. NOTE: Invalid data for Baseline in line 25 1-4. NOTE: Invalid data for After in line 25 6-10. NOTE: Invalid data for Difference in line 25 12-15. 25 Proc Mixed data = CrossOverMissing; 35 NOTE: Invalid data errors for file '"/home/u44908311/food_crossover_project/FoodCrossOverExample.sas"' occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Subject=. Gender=proc BMI=. Age=. Sequence== Period=. Treatment=run; Baseline=. After=. Difference=. _ERROR_=1 _N_=6 NOTE: Invalid data for Subject in line 26 3-7. NOTE: Invalid data for BMI in line 26 17-22. NOTE: Invalid data for Age in line 26 24-31. NOTE: Invalid data for Period in line 26 40-49. NOTE: Invalid data for Baseline in line 27 9-18. NOTE: Invalid data for After in line 27 20-20. NOTE: Invalid data for Difference in line 27 22-27. 27 model Difference = Gender BMI Age Period Treatment Baseline; 62 NOTE: Invalid data errors for file '"/home/u44908311/food_crossover_project/FoodCrossOverExample.sas"' occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Subject=. Gender=Subject BMI=. Age=. Sequence=Period Period=. Treatment=model Baseline=. After=. Difference=. _ERROR_=1 _N_=7 NOTE: Invalid data for Subject in line 28 3-8. NOTE: Invalid data for BMI in line 29 3-9. NOTE: Invalid data for Age in line 29 11-19. NOTE: Invalid data for Period in line 29 23-28. NOTE: LOST CARD. NOTE: Invalid data errors for file '"/home/u44908311/food_crossover_project/FoodCrossOverExample.sas"' occurred outside the printed range. NOTE: Increase available buffer lines with the INFILE n= option. Subject=. Gender=Subject; BMI=. Age=. Sequence=/ Period=. Treatment=run; Baseline=. After=. Difference=. _ERROR_=1 _N_=8 NOTE: 34 records were read from the infile "/home/u44908311/food_crossover_project/FoodCrossOverExample.sas". The minimum record length was 0. The maximum record length was 89. NOTE: SAS went to a new line when INPUT statement reached past the end of a line. NOTE: The data set WORK.CROSSOVER has 7 observations and 10 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 789.03k OS Memory 25256.00k Timestamp 09/27/2024 10:44:00 AM Step Count 58 Switch Count 2 Page Faults 0 Page Reclaims 87 Page Swaps 0 Voluntary Context Switches 15 Involuntary Context Switches 1 Block Input Operations 0 Block Output Operations 288 73 74 proc print data = CrossOver; 75 run; NOTE: There were 7 observations read from the data set WORK.CROSSOVER. NOTE: PROCEDURE PRINT used (Total process time): real time 0.01 seconds user cpu time 0.01 seconds system cpu time 0.00 seconds memory 1230.03k OS Memory 25256.00k Timestamp 09/27/2024 10:44:00 AM Step Count 59 Switch Count 0 Page Faults 0 Page Reclaims 63 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 1 Block Input Operations 0 Block Output Operations 8 76 77 Proc Mixed data = CrossOver; 78 class Subject Gender Sequence Period Treatment; 79 model Difference = Gender BMI Age Period Treatment Baseline; 80 random Subject; 81 lsmeans treatment / pdiff; 82 run; ERROR: Invalid or missing data. NOTE: PROCEDURE MIXED used (Total process time): real time 0.00 seconds user cpu time 0.01 seconds system cpu time 0.00 seconds memory 786.81k OS Memory 25256.00k Timestamp 09/27/2024 10:44:00 AM Step Count 60 Switch Count 0 Page Faults 0 Page Reclaims 89 Page Swaps 0 Voluntary Context Switches 3 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 0 83 84 85 Data CrossOverMissing; 86 infile "CrossOverMissing"; 87 input Subject Gender $ BMI Age Sequence $ Period Treatment $ Baseline After Difference; 88 run; ERROR: Physical file does not exist, /pbr/biconfig/940/Lev1/SASApp/CrossOverMissing. NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.CROSSOVERMISSING may be incomplete. When this step was stopped there were 0 observations and 10 variables. WARNING: Data set WORK.CROSSOVERMISSING was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 677.78k OS Memory 25256.00k Timestamp 09/27/2024 10:44:00 AM Step Count 61 Switch Count 0 Page Faults 0 Page Reclaims 55 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 8 89 90 proc print data = CrossOverMissing; 91 run; NOTE: No observations in data set WORK.CROSSOVERMISSING. NOTE: PROCEDURE PRINT used (Total process time): real time 0.00 seconds user cpu time 0.01 seconds system cpu time 0.00 seconds memory 635.15k OS Memory 25256.00k Timestamp 09/27/2024 10:44:00 AM Step Count 62 Switch Count 0 Page Faults 0 Page Reclaims 50 Page Swaps 0 Voluntary Context Switches 0 Involuntary Context Switches 0 Block Input Operations 0 Block Output Operations 0 92 93 Proc Mixed data = CrossOverMissing; 94 class Subject Gender Sequence Period Treatment; 95 model Difference = Gender BMI Age Period Treatment Baseline; 96 random Subject; 97 lsmeans treatment / pdiff; 98 run; ERROR: Invalid or missing data. NOTE: PROCEDURE MIXED used (Total process time): real time 0.00 seconds user cpu time 0.00 seconds system cpu time 0.00 seconds memory 595.15k OS Memory 25256.00k Timestamp 09/27/2024 10:44:00 AM Step Count 63 Switch Count 0 Page Faults 0 Page Reclaims 59 Page Swaps 0 Voluntary Context Switches 3 Involuntary Context Switches 1 Block Input Operations 0 Block Output Operations 0 99 100 101 102 103 104 105 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 115
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
thanks for your support.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Start addressing problems starting at the top of a program.
The first problem I see is a bunch of invalid data messages. Those occur when you try to read incompatible data from the instructions you have provided on the INPUT statement and Informats. Such as trying to read "abc" as a numeric value or reading a date that looks like 01JAN2020 with a YYMMDD informat that expects values like 20200101.
So since your data step
69 Data CrossOver; 70 infile "/home/u44908311/food_crossover_project/FoodCrossOverExample.sas"; 71 input Subject Gender $ BMI Age Sequence $ Period Treatment $ Baseline After Difference; 72 run;
it looks like you are trying to read a PROGRAM file, not data.
Lets examine the first "invalid data message" and describe how to read and interpret what it shows.
Please see in the first few lines where it has one of the Variable names from the INPUT statement and some details. First indicator is that there are different LINES mentioned. Those are lines in the source file.
So Subject was read from the first line starting at column 1 through 4 and was invalid. Your Input statement indicates subject should contain a numeric value so something not valid as a number was encountered.
BMI was read from line 2, columns 3 through 8. Again BMI on the input statement expects numeric values and ran into something else, as did Age
And Period, but that was reading at line 3 as were Baseline, After and Difference.
Now for a very important diagnostic. The part that says Rule is to help identify columns the + are values like 5, 15, 25, 35, etc. the 1, 2,3 are columns 10, 20,30.
The line in the log that starts with 3 shows the TEXT of the line. Which shows program code, not values.
So, why are you attempting to read a file containing CODE into a DATA set?????
The multiple lines are because your INFILE statement has no restriction to read on a single line, typically MISSOVER as used in the Proc Import generated code or TRUNCOVER.
NOTE: Invalid data for Subject in line 1 1-4. NOTE: Invalid data for BMI in line 2 3-8. NOTE: Invalid data for Age in line 2 10-75. NOTE: Invalid data for Period in line 3 9-15. NOTE: Invalid data for Baseline in line 3 24-24. NOTE: Invalid data for After in line 3 26-28. NOTE: Invalid data for Difference in line 3 30-32. RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0 3 input Subject Gender $ BMI Age Sequence $ Period Treatment $ Baseline After Difference; 89
Because so many of the variables in the resultant Crossover data set are missing code using it will likely not perform very well. Which is not surprising. So read a proper file containing data though it looks like the WORK.IMPORT is what you wanted.
So for the Data Crossover Infile statement read REFFILE, using a file reference, or '/home/u44908311/food_crossover_project/SBP_n13.csv' instead of "/home/u44908311/food_crossover_project/FoodCrossOverExample.sas". ADD delimiter=',' because the file is comma delimited and one of MISSOVER or TRUNCOVER (just in case one of the lines is short)
I see that you did a Proc Print data=crossover; Did you actually look at any of the results? Most of the variables would have been missing, which is what your proc mixed complains about, and the rest should have looked pretty odd for variables with names like Gender Sequence and Treatment.
So, READ the right file, the right way before attempting any analysis.