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

raw data I have is 

Datenamemarks1marks2marks3
Aug-20AAAA306080
Sep-20BBBB316181
Oct-20AAAA326282
Aug-20BBBB336383
Sep-20AAAA346484
Oct-20BBBB356585
Aug-20AAAA366686
Sep-20BBBB376787
Oct-20AAAA386888
Aug-20BBBB396989
Sep-20AAAA407090
Oct-20BBBB417191

                        I want to transform my raw data to be like this(below)

Aug-20AAAA66126166
Aug-20BBBB72132172
Sep-20AAAA74134174
Sep-20BBBB68128168
Oct-20AAAA70130170
Oct-20BBBB76136176

                                             Which procedure can i use to do get the desired output. Please give me the  syntax. I need answer as soon as possible.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Why did you drop the _TYPE_ variable?  That is the one that allows you to know which observations represent the overall summaries(_TYPE_=0) and which are the one way summaries (_TYPE_ in (1,2)) and which are the two way summaries.

If you only want the most detailed combinations then add the NWAY option to the PROC statement.

View solution in original post

6 REPLIES 6
Kurt_Bremser
Super User

Use

class date name;

and

var marks:;

in the summary procedure.

To create a dataset, use the output statement.

For detailed help, show the code you tried, and the log from it.

joherndon
Calcite | Level 5

Thanks for your quick reply. I used the same syntax you have provided. I am getting following out put. I don't want the first six rows.

I can use missing function and delete those values. but In my work I have millions of rows (four category variables). I used drop= _freq_ _type_  for my out put data set. So is there any short cut to get the data I want

 

 

generated out put

..4267861026
.AAAA210390510
.BBBB216396516
Aug-20.138258338
Sep-20.142262342
Oct-20.146266346
Aug-20AAAA66126166
Aug-20BBBB72132172
Sep-20AAAA74134174
Sep-20BBBB68128168
Oct-20AAAA70130170
Oct-20BBBB76136176

 

desired output

Aug-20AAAA66126166
Aug-20BBBB72132172
Sep-20AAAA74134174
Sep-20BBBB68128168
Oct-20AAAA70130170
Oct-20BBBB76136176

 

my syntax:

 

proc summary data=have;

class date name;

var marks:;

output out=want (drop=_freq_ _type_) sum=;

run;

 

Thanks in advance;

ed_sas_member
Meteorite | Level 14

Hi @joherndon 

 

You just need to add a WAYS statement as follows, which specifies the number of ways to make unique combinations of class variables:

proc summary data=have;
	class date name;
	var marks:;
	ways 2;
	output out=want (drop=_freq_ _type_) sum=;
run;

Best,

PaigeMiller
Diamond | Level 26

proc summary data=have nway;

class date name;

var marks:;

output out=want (drop=_freq_ _type_) sum=;

run;

--
Paige Miller
Tom
Super User Tom
Super User

Why did you drop the _TYPE_ variable?  That is the one that allows you to know which observations represent the overall summaries(_TYPE_=0) and which are the one way summaries (_TYPE_ in (1,2)) and which are the two way summaries.

If you only want the most detailed combinations then add the NWAY option to the PROC statement.

joherndon
Calcite | Level 5
Thanks for your help

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 6 replies
  • 991 views
  • 1 like
  • 5 in conversation