insert value from one file into new file

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

insert value from one file into new file

Keval Khichadia
Hi,

I am trying to take the week value associated with a given file and use that value in a new file.

dataset activate File1.
do if $casenum = 1.
write out = 'C:\Temp\useweek.sps'
/ 'define !USE_WEEK () '''WEEK ''' !enddefine.'.
end if.
exe.
 
dataset activate File2.
insert file = 'C:\Temp\useweek.sps'.
compute week = !USE_WEEK.
 
I get the follwing error:
 Invalid combination of data types in an assignment. Character strings may
>only be assigned to string variables.. Numeric and logical quantities may
>only be assigned to numeric variables. Consider using the STRING or NUMBER
>function.
>This command not executed.
 
When I try to create week as a string variable in file 2 and run the syntax I get the value '!U' for week. Any suggestions on how I can do this?
 
Thanks,
 
Keval




====================To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

AW: insert value from one file into new file

la volta statistics
Hi Keval
Try the following syntax. Hope this helps
Christian

Dataset close all.
NEW FILE.
DATA LIST LIST /id_1(F8) Week(F8).
BEGIN DATA
1 99
2 2
3 3
4 4
5 5
END DATA.
dataset Name File1.

dataset activate File1.
do if $casenum = 1.
write out = 'c:\Temp\useweek.sps'
/"DEFINE !USE_WEEK () "/"Compute Week = " Week /"!ENDDEFINE.".
end if.
exe.

DATA LIST LIST /id_1(F8) .
BEGIN DATA
1
2
END DATA.
dataset Name File2.


insert file = 'c:\Temp\useweek.sps'.
dataset activate File2.

!USE_WEEK.
Exec.


**********************************
Christian Schmidhauser, Dr.phil.II
Weinbergstrasse 108
CH-8006 Zürich
Tel: +41 (043) 233 98 01
Fax: +41 (043) 233 98 02
email: mailto:[hidden email]
Web: www.lavolta.ch


-----Ursprüngliche Nachricht-----
Von: SPSSX(r) Discussion [mailto:[hidden email]] Im Auftrag von
Keval Khichadia
Gesendet: Montag, 10. November 2008 18:48
An: [hidden email]
Betreff: insert value from one file into new file

Hi,

I am trying to take the week value associated with a given file and use that
value in a new file.

dataset activate File1.
do if $casenum = 1.
write out = 'C:\Temp\useweek.sps'
/ 'define !USE_WEEK () '''WEEK ''' !enddefine.'.
end if.
exe.

dataset activate File2.
insert file = 'C:\Temp\useweek.sps'.
compute week = !USE_WEEK.

I get the follwing error:
 Invalid combination of data types in an assignment. Character strings may
>only be assigned to string variables.. Numeric and logical quantities may
>only be assigned to numeric variables. Consider using the STRING or NUMBER
>function.
>This command not executed.

When I try to create week as a string variable in file 2 and run the syntax
I get the value '!U' for week. Any suggestions on how I can do this?

Thanks,

Keval




=======
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD