Page 1 of 1

column sampling

Posted: Tue Jan 31, 2012 5:29 am
by ashishm
Hi all,


I have to pick up data from a column randomly.My column datatype is varchar.I am using datastage 8.1.How can I do this????

Posted: Tue Jan 31, 2012 8:35 am
by chulett
We'll need a better explanation than that. Can you provide an example of your 'columns' and what the output of your 'random sampling' might look like?

Posted: Tue Jan 31, 2012 1:17 pm
by ashishm
Hi chulett

I have two input Sequential file each have two columns and their datatypes are varchar.My requirement is the output file have four columns.First two columns are direct mapping from first input file and other two columns have to be loaded with data randomly picked from the two columns in the second file.There is no business rule for picking up the data from the second input file.How can i do this.???

Posted: Tue Jan 31, 2012 2:10 pm
by jwiles
One potential method:

On your second file (which you will randomly select from), assign a sequential sequence number (NOT random) to each row. You could use row number generation in Sequential File stage, for example...this would probably be the best place to do it. The results should be 1, 2, 3, 4, ... number_of_rows

Knowing exactly how many rows are present in your second file, assign a random sequence number to each row of your first file, with a maximum value of the number of rows in the second file. You can use one of the random number functions in a transformer or use a column generator stage.

Then, using a lookup/join/merge, join the two files on the sequence number columns.

Regards,

Posted: Mon Feb 06, 2012 12:37 am
by Satwika
Hi ashishm ,

is it resolved? If so let us know how you did it. Thank you

Posted: Mon Feb 06, 2012 2:36 am
by ray.wurlod
It's not marked as resolved, nor is there any indication that U (one of our posters) had any involvement at all.

The second person personal pronoun in English is spelled "you".

Posted: Mon Feb 06, 2012 3:10 am
by Satwika
Thank you ray