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

Its a LASR Table, but the real root of the data are from a DBMS. By the way. With regards to your Maxim 3. I want to take jus the last quarter if that quarter occurs more then once in a type. How can I achieve that?

Kurt_Bremser
Super User

So something converts the DBMS data to a LASR table. This is the process that needs to be looked at.

Do you have a direct connection to the DBMS via SAS/ACCESS, or do you read an unload from the DB into SAS?

Kurt_Bremser
Super User

To retrieve the last entry for a quarter, sort by type, quarter and an optional item (e.g. date), then do

data compressed / view=compressed;
set have;
by type quarter;
if last.quarter;
run;

Since the view will be executed while the data is processed, it won't eat unnecessary disk space.

Ksharp
Super User
data have;
infile datalines truncover;
input type $ quarter :yymmn6. phase $;
format quarter yymmn6.;
datalines;
K-11     202001    1
K-11     202101    2
K-11     202003           
K-12     202101    3
K-12     202102           
K-12     202002    1
K-13     202002    2
K-13     202103    3
K-13     202104    2
;
proc transpose data=have out=want ;
by type;
var phase;
id quarter;
idlabel quarter;
run;
Andalusia
Obsidian | Level 7
I received the same output I received when I ran @Kurt_Bremser's transpose snippet

ERROR: The ID value "K-11" occurs twice in the same BY group.
ERROR: Too many bad BY groups.
Ksharp
Super User

You must have data like this :

K-11     202001    1
K-11     202101    2
K-11 202101 22 K-11 202003 K-12 202101 3 K-12 202102 K-12 202002 1 K-13 202002 2 K-13 202103 3 K-13 202104 2

 You need figure out what output you want to see for this data.

Andalusia
Obsidian | Level 7
@Ksharp. Read my new post under @Kurt_Bremser's last post. I've posted a new dataset.

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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