How to create a matrix with Na and certain values as 0

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

lotusfr
Posts: 9
Joined: Mon Jul 13, 2020 1:41 am

How to create a matrix with Na and certain values as 0

Postby lotusfr » Wed Jul 13, 2022 8:28 am

For example, I have a M=8*8 matrix and I want the default to be NA. But M(1-4,5-8) as 0

Thanks very much
Attachments
Capture.PNG
Capture.PNG (4.44 KiB) Viewed 3820 times

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: How to create a matrix with Na and certain values as 0

Postby EViews Gareth » Wed Jul 13, 2022 8:41 am

Lots of different ways. Here's one:

Code: Select all

matrix(8,8) x
x=na
matplace(x,0*@ones(4,4),1,5)
Follow us on Twitter @IHSEViews


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 19 guests