[vsni.co.uk] Contact us
Author Message
Post new topic

  GenStat  ~  Procedure parameter question

david@vsn.co.nz
Posted: Wed Jun 27, 2018 3:24 am Reply with quote
Joined: 30 Jul 2009 Posts: 283
Hi Andrew,

In FSPREADSHEET the parameter DATA can be a list, pointer, list of pointers or mixture of structures and pointers.
Internally I create a pointer to all the structures in the list and in pointers within the list.
The simplified code is below:

PROCEDURE [PARAMETER=pointer] ‘FSPREADSHEET’
PARAMETER DATA,…; MODE=p
CALC n = NVALUES(DATA)
POINTER [NVALUES=n] type,p
SCALAR type[]
POINTER p[]; VALUES=type[]
GETATTR [ATTR=type] DATA[]; SAVE=p[]
CALC p[] = type[] == 14
IF VSUM(p) > 0
POINTER _data_; VALUES=!p(#DATA[])
ELSE
POINTER _data_; VALUES=DATA
ENDIF

Then _data_ is a pointer to all structures in the list and within pointers in the list.
This works for mixtures of structures and pointers e.g.

VARIATE X[1...10],Y,Z
CALC X[1...10],Y,Z = !(1...10)
FSPREAD X,Y,Z

Regards, David.
______________________________________________
Dr David Baird Statistical Consultant and GenStat Developer
VSN (NZ) Limited (David@VSN.CO.NZ (David@VSN.CO.NZ))
8 Mariposa Crescent, Aidanfield, Christchurch 8025, New Zealand
Ph +64 3 3350588 Cell +64 21 1160803


From: GENSTAT-Request <GENSTAT@jiscmail.ac.uk> On Behalf Of Steve Langton
Sent: 27 June 2018 9:55 AM
To: GENSTAT@JISCMAIL.AC.UK
Subject: Re: Procedure parameter question



I usually use PARAMETER=dummy in procedures, but I’ve looked back and found one I wrote many years ago with PARAMETER=pointer. The way I got around the odd behaviour of SET/UNSET was to use the following lines, modified to use your parameter names:
SCALAR nvc;NVALUES(DATA)
GETAT [stype] LABELS[1...#nvc];sty[1...#nvc]
PRINT sty[][]

If LABELS is unset the sty[][] will be ‘dummy’, if it is set to a text structure they will be ‘text’.

I’m sure Roger or David will have a neater solution, but this seemed to work.

Steve

****************************************************************************
Steve Langton, Hallgarth, Leavening, Malton, N. Yorks. YO17 9SA
Phone: +44(0)1653 658346 Mobile: +44(0)7930478749
Email: stats@slangton.org.uk (stats@slangton.org.uk)
****************************************************************************


From: GENSTAT-Request <GENSTAT@jiscmail.ac.uk (GENSTAT@jiscmail.ac.uk)> On Behalf Of Andrew McLachlan
Sent: 26 June 2018 05:05
To: GENSTAT@JISCMAIL.AC.UK (GENSTAT@JISCMAIL.AC.UK)
Subject: Re: Procedure parameter question



Hi Murray

Yes, I had briefly thought of doing that, but as you say I then decided to try to use DATA as a simple list. I will give your approach some more thought.

Cheers,
Andrew Mc

Andrew McLachlan
Biometrician

From: GENSTAT-Request [mailto:GENSTAT@jiscmail.ac.uk (GENSTAT@jiscmail.ac.uk)] On Behalf Of Murray Hannah
Sent: Monday, 25 June 2018 11:47 a.m.
To: GENSTAT@JISCMAIL.AC.UK (GENSTAT@JISCMAIL.AC.UK)
Subject: Re: Procedure parameter question [SEC=UNCLASSIFIED]

Hi Andrew,

My work-around has been to use PARAMETER=dummy in the PROCEDURE directive, and to make the user supply the DATA explicitly as a pointer. This would mean specifying TYPE='pointer','text' instead of TYPE='variate','text' in the PARAMETER directive.

I expect you have thought of that but just want to make it work with DATA as a simple list. I will be interested to see responses to your question.

Regards
Murray.
********************************************************************************
Department of Economic Development, Jobs, Transport and Resources, Government of
Victoria, Victoria, Australia.

This email, and any attachments, may contain privileged and confidential
information. If you are not the intended recipient, you may not distribute or
reproduce this e-mail or the attachments. If you have received this message in
error, please notify us by return email.
********************************************************************************



To unsubscribe from the GENSTAT list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=GENSTAT&A=1
Quote:
The contents of this e-mail are confidential and may be subject to legal privilege. If you are not the intended recipient you must not use, disseminate, distribute or reproduce all or any part of this e-mail or attachments.  If you have received this e-mail in error, please notify the sender and delete all material pertaining to this e-mail.  Any opinion or views expressed in this e-mail are those of the individual sender and may not represent those of The New Zealand Institute for Plant and Food Research Limited.



To unsubscribe from the GENSTAT list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=GENSTAT&A=1


To unsubscribe from the GENSTAT list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=GENSTAT&A=1

Post generated using Mail2Forum (http://www.mail2forum.com)
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
Post new topic

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum