SAS Output
SAS Output
| A_Literacy_Category | Char | 4 | $4. | $4. | A Literacy Category |
| Age | Num | 8 | Age | ||
| AgeCategory | Char | 5 | $5. | $5. | AgeCategory |
| Anemia | Num | 8 | Anemia | ||
| Antibiotics | Num | 8 | Antibiotics | ||
| Behavior | Num | 8 | Behavior | ||
| Education | Char | 32 | $32. | $32. | Education |
| Exercise | Num | 8 | Exercise | ||
| Gender | Char | 1 | $1. | $1. | Gender |
| Grade_Completed | Num | 8 | Grade Completed | ||
| HgA1C | Num | 8 | HgA1C | ||
| Jaundice | Num | 8 | Jaundice | ||
| Medication | Char | 7 | $7. | $7. | Medication |
| Medication_2 | Char | 4 | $4. | $4. | Medication_2 |
| Menopause | Num | 8 | Menopause | ||
| Number_correct_answers | Num | 8 | Number correct answers | ||
| Race | Char | 5 | $5. | $5. | Race |
| Rectal | Num | 8 | Rectal | ||
| Subject | Num | 8 | Subject | ||
| Years_Diagnosed | Char | 10 | $10. | $10. | Years Diagnosed |
| Years_since_diagnosis | Num | 8 | Years since diagnosis |
This is my data, and I want it to sorted by subject number(#)
proc sort data = ia.literacy;
by #;
run;
result:
18 proc sort data = ia.literacy;
19 by #;
-
22
200
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, DECENDING, DESCENDING,
DESENDING, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_.
ERROR 200-322: The symbol is not recognized and will be ignored.
20 run;
I assume that your posted data is an output from Proc Contents andnot your actual data, correct?
Anyways, do like this
proc sort data=ia.literacy;
by Subject;
run;
I assume that your posted data is an output from Proc Contents andnot your actual data, correct?
Anyways, do like this
proc sort data=ia.literacy;
by Subject;
run;
I think you are onto something on the basis of varnum aka creation order or Alphabetic List of Variables and Attributes
proc contents data=sashelp.class position;
run;
SAS Output
| Alphabetic List of Variables and Attributes | |||
|---|---|---|---|
| # | Variable | Type | Len |
| 3 | Age | Num | 8 |
| 4 | Height | Num | 8 |
| 1 | Name | Char | 8 |
| 2 | Sex | Char | 1 |
| 5 | Weight | Num | 8 |
| Variables in Creation Order | |||
|---|---|---|---|
| # | Variable | Type | Len |
| 1 | Name | Char | 8 |
| 2 | Sex | Char | 1 |
| 3 | Age | Num | 8 |
| 4 | Height | Num | 8 |
| 5 | Weight | Num | 8 |
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.