BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
v307086
Calcite | Level 5

Hi all,
I want to know what if I don't use by statement in the proc statement and only use id and var statement, what will happen? Please help!

 

I have a code snippet with me.

 

If I use "by" statement in proc transpose (code snippet below). Then my output looks likes this

_1.PNG

 

_2.PNG

 

and If i don't include "by" statement, then my output looks like this(which is my desired output)-

_3.PNG

 

So, I have confusion about when to use by statement and when not?

 

Thank you in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

A BY statement puts results from each level of the BY variable (1, 2, 3 or 4) on its own row. Without the BY statement, results for 1, 2, 3 and 4 are on the same row.

 

--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

So, I have confusion about when to use by statement and when not?

 

If you want output that looks like the first table, you use a BY statement. If you want output that looks like the second table, then you don't use a BY statement.

--
Paige Miller
v307086
Calcite | Level 5
Yes sir, But what's exactly the use of by statement here. and when to use to it and when not, how will i know?
PaigeMiller
Diamond | Level 26

A BY statement puts results from each level of the BY variable (1, 2, 3 or 4) on its own row. Without the BY statement, results for 1, 2, 3 and 4 are on the same row.

 

--
Paige Miller

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