BookmarkSubscribeRSS Feed
gabras
Pyrite | Level 9

Hi,

 

i would like to create a sequence column in VA. Is it possible?

IDObjectSequence
1A1
1A2
1A3
1B1
2B1
2B2
2B3
1A4

 

I have to create it in VA because that matrix has to change based on filter someone might choose.

For example, if i choose a shorter period of time it could change like this (and the sequence accordingly):

IDObjectSequence
1A1
1B1
2B1
2B2
1A2

 

Can someone help me?

 

Thank you

9 REPLIES 9
akash1088
Obsidian | Level 7

you want to show as a list table ?

gabras
Pyrite | Level 9

Hi @akash1088,

 

yes.

Can i ask you why are you asking me this question? Would you suggest something else?

 

Thanks

akash1088
Obsidian | Level 7
hold ctrl key + press sequence + id + object.
may this can help ur requirment.

Basically you want to sort data on multiple variable in sas va right ?
gabras
Pyrite | Level 9

Yes.

 

I have to enumerate the record based on ID and Object.

I'm sorry but i'm new on sas VA:  i don't understand your piece of code. 😞

 

akash1088
Obsidian | Level 7

table.png

 

 

 

 

 

 

 

 

 

 

 

 

Holding CTRL key click on the column name in list table as per the sequence you want.

gabras
Pyrite | Level 9

@akash1088

i have to create the Sequence column, not just order the table.

 

One more question, do you know if i can take the value of a variable of the previous row?

In SAS Base i would use:

 

data want;
set have;
prev_date = lag(created);
if first.id then prev_date = created;
run;

akash1088
Obsidian | Level 7

can you just show one sample what exactly you want.

 

and sorry I don't know how to create that sequence column in sas va  but in base sas you can use this one.

hope this gonna help u.

 

Data have;
Infile datalines dlm='	';
input ID:1 Object:$1. ;	
datalines;
1	A	
1	A	
1	A	
1	B	
2	B	
2	B	
2	B
1	A
;
run;

Proc Sort data=have;
by ID Object;
Run;


data new;
set have;
by ID Object;
if first.object then sequence=0;
Sequence+1;
run;

 

gabras
Pyrite | Level 9

@akash1088

Thank you, but the problme is to create it in SAS VA.

In BASE is quite simple as you posted, but in VA it seems impossible. 

Any workaround?

FalkoSchulz
SAS Employee

Unfortunately the VA query engine doesn't allow such sequence or row based calculation and I'm not aware of a work-around other than calculating such as part of the data preparation step.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 9 replies
  • 1394 views
  • 0 likes
  • 3 in conversation