BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
minsung
Fluorite | Level 6

SAS Output

SAS Output

Alphabetic List of Variables and Attributes# Variable Type Len Format Informat Label212917131810143461578121920161115
A_Literacy_CategoryChar4$4.$4.A Literacy Category
AgeNum8  Age
AgeCategoryChar5$5.$5.AgeCategory
AnemiaNum8  Anemia
AntibioticsNum8  Antibiotics
BehaviorNum8  Behavior
EducationChar32$32.$32.Education
ExerciseNum8  Exercise
GenderChar1$1.$1.Gender
Grade_CompletedNum8  Grade Completed
HgA1CNum8  HgA1C
JaundiceNum8  Jaundice
MedicationChar7$7.$7.Medication
Medication_2Char4$4.$4.Medication_2
MenopauseNum8  Menopause
Number_correct_answersNum8  Number correct answers
RaceChar5$5.$5.Race
RectalNum8  Rectal
SubjectNum8  Subject
Years_DiagnosedChar10$10.$10.Years Diagnosed
Years_since_diagnosisNum8  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;

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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;

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

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;
novinosrin
Tourmaline | Level 20

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

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1109 views
  • 3 likes
  • 3 in conversation