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-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 948 views
  • 0 likes
  • 2 in conversation