Hi Patrick
apologies I forgot to reply. Thank you for the syntaxes. I tried the first one, which did not work as intended, for some reason it deleted the last character of the whole of the column I wanted to select the data range from!
Not being proficient in programming I then used the workaround of copying the whole column to a new dataset, and then perform a select case function. Clunky, but I got the data I needed!
Cheers.
------------------------------
Australian User
------------------------------
Original Message:
Sent: Fri November 17, 2023 06:34 AM
From: Patrick Henry-Lucet
Subject: How to select data range
Hello there.
You coud use something like:
dataset copy new_data_set.
dataset activate new_data_set.
compute num = $casenum.
selecf if num ge 1000 and num le 2000.
match files
/file = *
/keep =
Var_A.
execute.
Or:
if $casenum ge 1000 and $casenum le 2000 Var_B = Var_A.
Oddly, $casenum seems not to work directly with select if.
------------------------------
Patrick Henry-Lucet
Original Message:
Sent: Thu November 16, 2023 09:05 PM
From: Australian User
Subject: How to select data range
Hi,
I am seeking help in copying a range of data from a variable/column. For example I would like to copy data from cells 1000 to 2000 only out of Var A in a file with 5000 cases. I hope I have described this correctly!
Thanks.
------------------------------
Australian User
------------------------------