How to get a case value for calculations in custom dialog box

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

How to get a case value for calculations in custom dialog box

Rajeshms
Hi All,

I have to do some calculations, so for that I have created a dialog box for that. Now I have to pick a case value , here all the cases will have same value.Say for eg 2350 is my value and all the cases of my created variable will be having 2350 only. Next I have to use this value 2350 for choosing a random sample from the data. 

SAMPLE  2350 from %%Totalsample%%. 

In my custom dialog box 2350 will be varying for different data sets, so how can i make pointer for that in custom dialog box.

I am facing the problem to point the case in the syntax of custom dialog building.



--
Regards,

Rajesh M S




Reply | Threaded
Open this post in threaded view
|

Re: How to get a case value for calculations in custom dialog box

David Marso
Administrator
AFAICT, the CD is even less data aware than macros ;-( as if that is even possible)
You will probably have to roll your own.  VB, python? argh?
Good luck with that!

Rajeshms wrote
Hi All,

I have to do some calculations, so for that I have created a dialog box for
that. Now I have to pick a case value , here all the cases will have same
value.Say for eg 2350 is my value and all the cases of my created variable
will be having 2350 only. Next I have to use this value 2350 for choosing a
random sample from the data.

SAMPLE * 2350* from %%Totalsample%%.

In my custom dialog box* 2350* will be varying for different data sets, so
how can i make pointer for that in custom dialog box.

I am facing the problem to point the case in the syntax of custom dialog
building.



--
Regards,

Rajesh M S
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: How to get a case value for calculations in custom dialog box

Art Kendall
In reply to this post by Rajeshms
Have you looked at the COMPLEX SAMPLES option?



Art Kendall
Social Research Consultants
On 11/8/2013 1:56 AM, Rajeshms [via SPSSX Discussion] wrote:
Hi All,

I have to do some calculations, so for that I have created a dialog box for that. Now I have to pick a case value , here all the cases will have same value.Say for eg 2350 is my value and all the cases of my created variable will be having 2350 only. Next I have to use this value 2350 for choosing a random sample from the data. 

SAMPLE  2350 from %%Totalsample%%. 

In my custom dialog box 2350 will be varying for different data sets, so how can i make pointer for that in custom dialog box.

I am facing the problem to point the case in the syntax of custom dialog building.



--
Regards,

Rajesh M S







If you reply to this email, your message will be added to the discussion below:
http://spssx-discussion.1045642.n5.nabble.com/How-to-get-a-case-value-for-calculations-in-custom-dialog-box-tp5722918.html
To start a new topic under SPSSX Discussion, email [hidden email]
To unsubscribe from SPSSX Discussion, click here.
NAML

Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: How to get a case value for calculations in custom dialog box

David Marso
Administrator
In reply to this post by David Marso
OTOH: Maybe WinWrap Basic (scripting for those who might care) could be of use.
You should be able to grab the data and populate a dialog.
This is just a proof of concept with a MsgBox.
Good luck, have fun...
D

'#Language "WWB-COM"

Option Explicit

Sub Main
        Dim x As Variant
        Dim y As String
        Dim msg As VbMsgBoxResult
        With objSpssApp.Documents.GetDataDoc(0)
                x=.GetTextData(  "var00001","var00002",1,1)
        End With
        Debug.Print CStr( x(0,0))
        y=CStr(x(0,0))
        msg=MsgBox ( y,vbOkCancel ,"Hello world")
End Sub



David Marso wrote
AFAICT, the CD is even less data aware than macros ;-( as if that is even possible)
You will probably have to roll your own.  VB, python? argh?
Good luck with that!

Rajeshms wrote
Hi All,

I have to do some calculations, so for that I have created a dialog box for
that. Now I have to pick a case value , here all the cases will have same
value.Say for eg 2350 is my value and all the cases of my created variable
will be having 2350 only. Next I have to use this value 2350 for choosing a
random sample from the data.

SAMPLE * 2350* from %%Totalsample%%.

In my custom dialog box* 2350* will be varying for different data sets, so
how can i make pointer for that in custom dialog box.

I am facing the problem to point the case in the syntax of custom dialog
building.



--
Regards,

Rajesh M S
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: How to get a case value for calculations in custom dialog box

Andy W
In reply to this post by Rajeshms
Presuming the "calculations" result in a subsequent variable in the dataset, lets name it "Sel", if a sort is reasonable you can just create a random variable, sort by that, and then select all rows above that value.

COMPUTE Sel = 2350.
COMPUTE Ran = RV.NORMAL(0,1).
SORT CASES BY Ran.
SELECT IF $casenum >= Sel.

If a sort isn't reasonable, the custom dialog builder can submit python or R code chunks. You could just have python grab the first case of the resultant Sel variable and submit that value to the SAMPLE command.

There appears to be no direct need to have the 2350 value directly populated in the custom dialog directly.

Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: How to get a case value for calculations in custom dialog box

Andy W
Whoops I mean below that value in the selection!

COMPUTE Sel = 2350.
COMPUTE Ran = RV.NORMAL(0,1).
SORT CASES BY Ran.
SELECT IF $casenum <= Sel.
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: How to get a case value for calculations in custom dialog box

Jon K Peck
In reply to this post by Rajeshms
Are you trying to pick from the current values of a variable in the active dataset?  The CDB does not pass the case data (nor do the built-in dialogs with just a few exceptions).  You can populate a listbox or combo box control from a target list or from value labels or custom attributes, but a dialog cannot access the actual data.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        Rajeshms <[hidden email]>
To:        [hidden email],
Date:        11/07/2013 10:55 PM
Subject:        [SPSSX-L] How to get a case value for calculations in custom              dialog box
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi All,

I have to do some calculations, so for that I have created a dialog box for that. Now I have to pick a case value , here all the cases will have same value.Say for eg 2350 is my value and all the cases of my created variable will be having 2350 only. Next I have to use this value 2350 for choosing a random sample from the data. 

SAMPLE  2350 from %%Totalsample%%. 

In my custom dialog box 2350 will be varying for different data sets, so how can i make pointer for that in custom dialog box.

I am facing the problem to point the case in the syntax of custom dialog building.



--
Regards,

Rajesh M S