BookmarkSubscribeRSS Feed
rkdownload
Calcite | Level 5

Hi,

 

Below mentioned code works as expect when we remove following line of code from proc sort

sortseq = linguistic(strength=primary numeric_collation=on) but not with it

Any help in regard would be highly appreciated.

 

Thanks

Raj

 

=======================================

 

data Test;
infile datalines delimiter='09'x;
informat ID 8. USUBJID $50. VISITNUM VSTPTNUM PULSE TEMP SYS DIA 8.;
input ID USUBJID VISITNUM VSTPTNUM PULSE TEMP SYS DIA;
datalines;
1 009/01-001-S1 1 1 93 98.5 116 78
2 009/01-001-S1 2 2 97 98.4 164 100
3 009/01-001-S1 2 3 103 . 128 106
4 009/01-001-S1 2 4 107 . 150 84
5 009/01-001-S1 2 5 112 97.1 100 78
6 009/01-001-S1 3 2 91 98.1 134 98
7 009/01-001-S1 3 3 90 . 116 46
8 009/01-001-S1 3 4 113 . 138 90
9 009/01-001-S1 3 5 57 96.3 106 72
10 009/01-001-S2 1 1 86 97.3 130 90
11 009/01-001-S2 2 2 58 96.5 104 46
12 009/01-001-S2 2 3 82 . 112 70
13 009/01-001-S2 2 4 95 . 162 82
14 009/01-001-S2 2 5 76 95.6 124 102
15 009/01-001-S3 1 1 73 96.6 132 84
16 009/01-001-S3 2 2 75 96.9 100 76
17 009/01-001-S3 2 3 79 . 154 110
18 009/01-001-S3 2 4 78 . 164 94
19 009/01-001-S3 2 5 107 97.0 102 58
20 009/01-001-S3 3 2 76 98.1 78 80
21 009/01-001-S3 3 3 78 . 156 80
22 009/01-001-S3 3 4 85 . 134 94
23 009/01-001-S3 3 5 110 96.8 136 90
24 009/01-001-S4 1 1 78 95.9 136 82
25 009/01-001-S4 2 2 84 97.6 92 68
26 009/01-001-S4 2 3 63 . 84 66
27 009/01-001-S4 2 4 78 . 166 82
28 009/01-001-S4 2 5 95 95.4 100 70
29 009/01-001-S4 3 2 72 95.9 88 48
30 009/01-001-S4 3 3 55 . 104 74
31 009/01-001-S4 3 4 105 . 110 48
32 009/01-001-S4 3 5 119 95.8 136 100
33 009/01-001-S5 1 1 68 97.3 108 66
34 009/01-001-S5 2 2 50 96.7 158 120
35 009/01-001-S5 2 3 115 . 126 110
36 009/01-001-S5 2 4 56 . 122 114
37 009/01-001-S5 2 5 49 96.3 132 86
38 009/01-001-S5 3 2 59 97.4 138 98
39 009/01-001-S5 3 3 70 . 156 96
40 009/01-001-S5 3 4 99 . 128 98
41 009/01-001-S5 3 5 81 96.3 150 114
42 009/01-001-S6 1 1 63 97.7 116 78
43 009/01-001-S6 2 2 105 95.6 80 64
44 009/01-001-S6 2 3 98 . 138 92
45 009/01-001-S6 2 4 93 . 88 66
46 009/01-001-S6 2 5 97 97.3 122 102
47 009/01-001-S6 3 2 105 97.0 116 46
48 009/01-001-S6 3 3 57 . 154 80
49 009/01-001-S6 3 4 116 . 100 76
50 009/01-001-S6 3 5 62 95.3 154 100
51 009/01-001-S7 1 1 86 95.3 104 74
52 009/01-001-S7 2 2 48 98.1 138 96
53 009/01-001-S7 2 3 64 . 108 54
54 009/01-001-S7 2 4 54 . 94 80
55 009/01-001-S7 2 5 67 97.5 156 112
56 009/01-001-S7 3 2 61 98.0 78 70
57 009/01-001-S7 3 3 72 . 154 98
58 009/01-001-S7 3 4 107 . 128 112
59 009/01-001-S7 3 5 54 95.8 112 58
60 009/01-001-S8 1 1 67 96.8 134 86
61 009/01-001-S8 2 2 58 98.3 92 54
62 009/01-001-S8 2 3 72 . 118 58
63 009/01-001-S8 2 4 68 . 124 106
64 009/01-001-S8 2 5 61 96.6 100 76
65 009/01-001-S8 3 2 114 96.7 146 110
66 009/01-001-S8 3 3 94 . 120 62
67 009/01-001-S8 3 4 117 . 84 52
68 009/01-001-S8 3 5 85 97.0 148 106
69 009/01-001-S9 1 1 86 97.4 130 82
70 009/01-001-S9 2 2 50 95.4 110 68
71 009/01-001-S9 2 3 74 . 146 116
72 009/01-001-S9 2 4 93 . 150 102
73 009/01-001-S9 2 5 110 95.8 74 62
74 009/01-001-S9 3 2 86 97.5 114 56
75 009/01-001-S9 3 3 99 . 104 78
76 009/01-001-S9 3 4 61 . 154 84
77 009/01-001-S9 3 5 69 97.2 108 74
78 009/01-001-S10 1 1 64 96.2 98 70
79 009/01-001-S10 2 2 73 95.5 102 66
80 009/01-001-S10 2 3 69 . 164 114
81 009/01-001-S10 2 4 50 . 122 84
82 009/01-001-S10 2 5 97 96.6 138 98
83 009/01-001-S10 3 2 83 98.0 88 46
84 009/01-001-S10 3 3 100 . 122 96
85 009/01-001-S10 3 4 80 . 158 116
86 009/01-001-S10 3 5 103 97.5 112 44
87 009/01-001-S11 1 1 86 97.1 136 80
88 009/01-001-S11 2 2 97 97.3 120 60
89 009/01-001-S11 2 3 86 . 130 82
90 009/01-001-S11 2 4 102 . 100 64
91 009/01-001-S11 2 5 50 98.0 102 52
92 009/01-001-S11 3 2 55 96.6 144 84
93 009/01-001-S11 3 3 60 . 158 110
94 009/01-001-S11 3 4 118 . 102 66
95 009/01-001-S11 3 5 73 96.9 150 116
96 009/01-001-S12 1 1 62 95.6 114 60
97 009/01-001-S12 2 2 55 96.4 94 46
98 009/01-001-S12 2 3 85 . 166 84
99 009/01-001-S12 2 4 77 . 168 116
100 009/01-001-S12 2 5 77 98.0 162 112
;
run;

proc sort data=Test sortseq = linguistic(strength=primary numeric_collation=on);
by USUBJID VISITNUM VSTPTNUM;
run;

proc transpose data=Test out=Result;
by USUBJID VISITNUM VSTPTNUM;
var PULSE TEMP SYS DIA;
run;

3 REPLIES 3
ballardw
Super User

The BY statement in other procedures are not aware of the SORTseq options. If you need to use By some processes, like Transpose, you should add a variable that behaves as needed prior to the transpose. Or possibly use the BY NOTSORTED option in Proc Transpose the values get treated as groups regardless of BY behavior.

proc transpose data=Test out=Result;
   by notsorted USUBJID VISITNUM VSTPTNUM;
   var PULSE TEMP SYS DIA;
run;

 

If you are going to use TABS to delimit data you really need to paste the code into a text box as the message windows reformat white space characters. As shown your data step does not run because of the way the forum changes things.

rkdownload
Calcite | Level 5

Hi Ballardw, 

That didn't work as expected. Please also find attached the corresponding sas code file for your reference .

Thanks

Raj

rkdownload
Calcite | Level 5

Is this a bug?

Because proc transpose with notsorted in by clause is not working as expected when data is sorted with linguistic option and containing both character and numeric variables  in by clause of proc sort

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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