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

A is:

 

               course1  course 2 course3 course4

school1:  3   2   4   1

school2: 2 1 0 3

school3: 4 6 3 2

 

B is 

school1 course1  3

school1 course2 2

school1 course2 4

school1 course2 1

school2 course2 2

school2 course2 1

school2 course2 0

school2 course2 3

school3 course2 4

school3 course2 6

school3 course2 3

school3 course2 2

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

Okay in that case you can explicitly type those names or use var1--varN (double dash variable list)

View solution in original post

4 REPLIES 4
novinosrin
Tourmaline | Level 20

data a;
input school $    course1  course2 course3 course4 ;
cards;
school1  3   2   4   1

school2 2 1 0 3

school3 4 6 3 2
;

proc transpose data=a out=b;
by school;
var course1-course4;
run;
walterwang
Obsidian | Level 7
thanks,
But course1 -course4 are math, english etc

.
novinosrin
Tourmaline | Level 20

Okay in that case you can explicitly type those names or use var1--varN (double dash variable list)

walterwang
Obsidian | Level 7
course names look like:

CPC10108 (11) CPC10111 (11) CPC20111 (11) CPC20112 (11) CPC20211 (11) CPC20712 (11) CPC20812 (11) CPC30111 (11) CPC30116 (11) CPC30211 (11) CPC30216 (11) CPC30313 (11) CPC30318 (11) CPC30411 (11) CPC30413 (11) CPC30508 (11) CPC30511 (11) CPC30611 (11) CPC30708 (11) CPC30711 (11)
and there are more than 100 courses.
how to write variable?
Many thanks.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 4 replies
  • 520 views
  • 0 likes
  • 2 in conversation