Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

SAS Visual Analytics create a Sequence variable

Reply
Contributor
Posts: 62

SAS Visual Analytics create a Sequence variable

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

Occasional Contributor
Posts: 16

Re: SAS Visual Analytics create a Sequence variable

you want to show as a list table ?

Contributor
Posts: 62

Re: SAS Visual Analytics create a Sequence variable

Posted in reply to akash1088

Hi @akash1088,

 

yes.

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

 

Thanks

Occasional Contributor
Posts: 16

Re: SAS Visual Analytics create a Sequence variable

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 ?
Contributor
Posts: 62

Re: SAS Visual Analytics create a Sequence variable

Posted in reply to akash1088

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. Smiley Sad

 

Occasional Contributor
Posts: 16

Re: SAS Visual Analytics create a Sequence variable

table.png

 

 

 

 

 

 

 

 

 

 

 

 

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

Contributor
Posts: 62

Re: SAS Visual Analytics create a Sequence variable

Posted in reply to akash1088

@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;

Occasional Contributor
Posts: 16

Re: SAS Visual Analytics create a Sequence variable

[ Edited ]

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;

 

Contributor
Posts: 62

Re: SAS Visual Analytics create a Sequence variable

Posted in reply to akash1088

@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?

SAS Super FREQ
Posts: 106

Re: SAS Visual Analytics create a Sequence variable

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.

Ask a Question
Discussion stats
  • 9 replies
  • 111 views
  • 0 likes
  • 3 in conversation