How can I change all the column in $8.?
Below is my code
data workout;
input Day1-Day7 $8. ;
datalines;
chest leg back rest chest leg back;
run;
And the result only show the last column "Day7" with "back" and other column just show "." only
>Solution :
First of all, your code will likely not produce any output. The semicolon ; ending the data enumeration should be located on a separate line, not on the same line as your records.
Secondly, only Day7 has a value because it is the only variable that you specify as character. Make sure to use parenthesis around the type and length and use the colon : modifier to tell SAS to read the variables until there is a space or delimiter (:$8.).
Also, the run; at the end is not needed, but does not harm any 😉
data workout;
input (Day1-Day7) (:$8.);
datalines;
chest leg back rest chest leg back
;
chest leg back rest chest leg back